Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IADsPathname::Retrieve method

The IADsPathname::Retrieve method retrieves the path of the object with different format types.

Syntax


HRESULT Retrieve(
  [in]  long lnFormatType,
  [out] BSTR *pbstrADsPath
);

Parameters

lnFormatType [in]

Specifies the format that the path should be retrieved in. This can be one of the values specified in the ADS_FORMAT_ENUM enumeration.

pbstrADsPath [out]

Contains a pointer to a BSTR value the receives the object path. The caller must free this memory with the SysFreeString function when it is no longer required.

Return value

This method supports the standard return values, as well as the following.

For more information and other return values, see ADSI Error Codes.

Return codeDescription
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.

 

Examples

The following code example shows how to retrieve the provider name of the "LDAP://serv1/dc=dom, dc=company,dc=com" path.


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 code example shows how to retrieve the provider name of the "LDAP://serv1/dc=dom, dc=company,dc=com" path.


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 code example shows how use IADsPathname::Retrieve method to obtain the path.


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();

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Iads.h

DLL

Activeds.dll

IID

IID_IADsPathname is defined as D592AED4-F420-11D0-A36E-00C04FB950DC

See also

ADS_FORMAT_ENUM
SysFreeString
IADsPathname
ADSI Error Codes

 

 

Show:
© 2015 Microsoft