Directory Services |
The IADsPathname::Retrieve method retrieves the path of the object with different format types.
HRESULT Retrieve( long lnFormatType, BSTR* pbstrADsPath );
This method supports the standard return values, as well as the following.
For more information and other return values, see ADSI Error Codes:
Return Code | Description |
---|---|
S_OK | The operation succeeded. |
E_FAIL | The operation failed. |
E_ADS_BAD_PATHNAME | The path set is not supported in this retrieval format. |
E_INVALIDARG | The user has supplied an invalid dwFormatType parameter. |
The following Visual Basic code example shows how to retrieve the provider name of the "LDAP://serv1/dc=dom, dc=company,dc=com" pathname.
Const ADS_SETTYPE_FULL = 1 Const ADS_FORMAT_PROVIDER = 10 Dim x as New Pathname x.Set "LDAP://serv1/dc=dom,dc=company,dc=com", ADS_SETTYPE_FULL y = x.Retrieve(ADS_FORMAT_PROVIDER) ' y now equals "LDAP".
The following Visual Basic code example shows how to retrieve the provider name of the "LDAP://serv1/dc=dom, dc=company,dc=com" pathname.
const ADS_SETTYPE_FULL = 1 const ADS_FORMAT_PROVIDER = 10 Dim x Set x = CreateObject("Pathname") x.Set "LDAP://serv1/dc=dom,dc=company,dc=com", ADS_SETTYPE_FULL y = x.Retrieve(ADS_FORMAT_PROVIDER) ' y now equals "LDAP".
The following C++ code example shows how use IADsPathname::Retrieve method to obtain the path name.
LPWSTR adsPath = L"WinNT://machine/aUser,user"; IADsPathname * pPath = GetPathnameObject(adsPath); if (!pPath) { return; } HRESULT hr = SetDisplayType(pPath, ADS_DISPLAY_FULL); BSTR bstr; hr = pPath->Retrieve(ADS_FORMAT_PROVIDER, &bstr); printf("Provider of the path retrieved is %S\n",bstr); SysFreeString(bstr); pPath->Release();
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.
ADS_FORMAT_ENUM, SysFreeString, IADsPathname, ADSI Error Codes