Platform SDK: Active Directory, ADSI, and Directory Services

IDirectoryObject::GetObjectInformation

The IDirectoryObject::GetObjectInformation retrieves a pointer to an ADS_OBJECT_INFO structure that contains information about 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 information about the requested directory service object. If ppObjInfo is NULL on return, GetObjectInformation cannot obtain the information requested.

Return Values

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

Remarks

The caller should call ADsFreeMem helper function to release the ADS_OBJECT_INFO structure that GetObjectInformation creates.

Automation clients must call IADs::GetInfo.

Example Code [C++]

The following C++ code snippet illustrates how to retrieve the object information (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);
 
///////////////////////////////////////////////////////////
// Do not forget to clean up the memory using FreeADsMem!
//////////////////////////////////////////////////////////
FreeADsMem( pInfo );

Requirements

  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.

See Also

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