| Platform SDK: Active Directory, ADSI, and Directory Services |
The IDirectoryObject::SetObjectAttributes method modifies the information of one or more specified attributes of the directory service object, as defined in the ADS_ATTR_INFO structure.
HRESULT SetObjectAttributes( PADS_ATTR_INFO pAttributeEntries, DWORD dwNumberAttributes, DWORD * pdwNumAttributesModified );
This method returns the standard return values, including S_OK when the attributes are set successfully.
For other return values, see ADSI Error Codes.
In Active Directory™ (LDAP provider), the IDirectoryObject::SetObjectAttributes method is a transacted call. The attributes are either all committed or discarded. Other directory providers may not transact the call.
The following C++ code snippet sets the "sn" attribute of a user object to the value of "William" as a case insensitive string.
HRESULT hr;
IDirectoryObject *pDirObject=NULL;
DWORD dwReturn;
ADSVALUE snValue;
ADS_ATTR_INFO attrInfo[] = { {L"sn",ADS_ATTR_UPDATE,ADSTYPE_CASE_IGNORE_STRING,&snValue,1} };
DWORD dwAttrs = sizeof(attrInfo)/sizeof(ADS_ATTR_INFO);
snValue.dwType=ADSTYPE_CASE_IGNORE_STRING;
snValue.CaseIgnoreString = L"William";
hr = ADsGetObject(L"LDAP://CN=David Johnson,OU=Sales,DC=Microsoft,DC=com",
IID_IDirectoryObject,
(void**) &pDirObject );
if ( SUCCEEDED(hr) )
{
hr=pDirObject->SetObjectAttributes(attrInfo, dwAttrs, &dwReturn);
}
pDirObject->Release();
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
Windows 95/98: Requires Windows 95 or later (with DSClient).
Header: Declared in Iads.h.