Directory Services

IDirectoryObject::GetObjectInformation

The IDirectoryObject::GetObjectInformation method retrieves a pointer to an ADS_OBJECT_INFO structure that contains data regarding the identity and location of a directory service object.

HRESULT GetObjectInformation( 
  PADS_OBJECT_INFO* ppObjInfo
);

Parameters

ppObjInfo
[out] Provides the address of a pointer to an ADS_OBJECT_INFO structure that contains data regarding the requested directory service object. If ppObjInfo is NULL on return, GetObjectInformation cannot obtain the requested data.

Return Values

This method returns the standard return values, including S_OK when the data is obtained successfully. For more information and other return values, see ADSI Error Codes.

Remarks

The caller should call the FreeADsMem helper function to release the ADS_OBJECT_INFO structure created by the GetObjectInformation function.

Automation clients must call IADs::GetInfo.

Example Code [C++]

The following C++ code example shows how to retrieve the object data (ADS_OBJECT_INFO) using the GetObjectInformation method of an object (m_pDirObject) that implements the IDirectoryObject interface.

ADS_OBJECT_INFO *pInfo;
HRESULT hr;
 
hr = m_pDirObject->GetObjectInformation(&pInfo);
if (!SUCCEEDED(hr) )
{
   return;
}
 
//////////////////////////
// Show the attributes 
/////////////////////////
 
printf("RDN: %S\n", pInfo->pszRDN);
printf("ObjectDN: %S\n", pInfo->pszObjectDN);
printf("Parent DN: %S\n", pInfo->pszParentDN);
printf("Class Name: %S\n", pInfo->pszClassName);
printf("Schema DN: %S\n", pInfo->pszSchemaDN);
 
///////////////////////////////////////////////////////////
// Remember to clean up the memory using FreeADsMem.
//////////////////////////////////////////////////////////
FreeADsMem( pInfo );

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

IDirectoryObject, ADS_OBJECT_INFO, IADs::GetInfo, ADSI Error Codes