Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsPathname::Retrieve method retrieves the path of the object with different format types.
HRESULT IADsPathname::Retrieve( long dwFormatType, BSTR *pbstrADsPath );
This method supports the standard return values, as well as the following:
For other return values, see ADSI Error Codes.
The following Visual Basic® code snippet shows how to retrieve the provider name of the "LDAP://serv1/dc=dom, dc=company,dc=com" pathname.
Dim x as New Pathname x.Set "LDAP://serv1/dc=dom,dc=company,dc=com" y = x.Retrieve(ADS_FORMAT_PROVIDER) ' y now equals "LDAP".
The following VBScript code snippet shows how to retrieve the provider name of the "LDAP://serv1/dc=dom, dc=company,dc=com" pathname.
Dim x const ADS_FORMAT_PROVIDER = 10 Set x = CreateObject("Pathname") x.Set "LDAP://serv1/dc=dom,dc=company,dc=com" y = x.Retrieve(ADS_FORMAT_PROVIDER) ' y now equals "LDAP".
The following C++ code snippet shows how use IADsPathname::Retrieve method to obtain the path name string.
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();
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.