Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsPathname::Set method sets the Pathname object up for parsing a directory path. The path is set with a format as defined in ADS_SETTYPE_ENUM.
HRESULT IADsPathname::Set( BSTR bstrADsPath, DWORD dwSetType );
This method supports the standard return values, as well as the following:
For other return values, see ADSI Error Codes.
This method will set the namespace as specified and identify the appropriate provider for carrying out the path cracking operation. Resetting to a different namespace will result in lose of information already set by this method.
The following Visual Basic® code snippet sets a full ADSI path on the Pathname object.
Dim x As New Pathname x.Set "LDAP://server/CN=Jane Smith, DC=Microsoft, DC=Com", ADS_SETTYPE_FULL dn = x.GetElement(0) ' dn now is "CN=Jane Smith".
The following VBScript/ASP code snippet sets a full ADSI path on the Pathname object.
<% Dim x const ADS_SETTYPE_FULL = 1 Set x = CreateObject("Pathname") path = "LDAP://server/CN=Jane Smith, DC=Microsoft,DC=com" x.Set path, ADS_SETTYPE_FULL dn = x.GetElement(0) ' dn now is "CN=Jane Smith".
The following C++ code snippet sets a full ADSI path on the Pathname object.
IADsPathname *pPathname=NULL; HRESULT hr; hr = CoCreateInstance(CLSID_Pathname, NULL, CLSCTX_INPROC_SERVER, IID_IADsPathname, (void**)&pPathname); if(FAILED(hr)) { if(pPathname) pPathname->Release(); return NULL; } hr = pPathname->Set(L"LDAP://CN=foo /bar",ADS_SETTYPE_FULL);
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.