IADsPathname interface

The IADsPathname interface parses the X.500 and Windows path in ADSI.

The IADsPathname interface can be used to:

  • Set and get paths of ADSI objects in different formats.
  • Extract or add each element for a given ADsPath.
  • Construct ADsPaths to be used in queries of directory objects.

The IADsPathname interface is implemented on a Pathname object. You must instantiate the Pathname object to use the methods defined in the IADsPathname interface. This requirement is similar to calling the CoCreateInstance() function in C++.


IADsPathname *pPathname=NULL;
HRESULT hr;
 
hr = CoCreateInstance(CLSID_Pathname,
                      NULL,
                      CLSCTX_INPROC_SERVER,
                      IID_IADsPathname,
                      (void**)&pPathname);

You can also invoke the New operator in Visual Basic:

Dim path As New Pathname

Or use the CreateObject function in VBScript, supplying "Pathname" as the ProgID.

Dim path
Set path = CreateObject("Pathname")

The IADsPathname interface uses two enumeration types: ADS_SETTYPE_ENUM, and ADS_FORMAT_ENUM.

Members

The IADsPathname interface inherits from the IDispatch interface. IADsPathname also has these types of members:

Methods

The IADsPathname interface has these methods.

MethodDescription
AddLeafElement

Adds an element to the end of the path.

CopyPath

Generates an object with the same path.

GetElement

Gets elements stored in the object with its index.

GetEscapedElement

Escapes an RDN string and returns the output.

GetNumElements

Gets the number of elements in the path.

RemoveLeafElement

Removes the last element from the object.

Retrieve

Retrieves an object path with an ADS_FORMAT_ENUM type.

Set

Sets an object path with an ADS_SETTYPE_ENUM option.

SetDisplayType

Specifies how a path is to be displayed.

 

Properties

The IADsPathname interface has these properties.

PropertyAccess typeDescription

EscapedMode

Read/write

Retrieves the mode for escaping a path.

 

Examples

The following Visual Basic code example shows how to create an IADsPathname object.

Dim x As New Pathname
x.Set "LDAP", ADS_SETTYPE_PROVIDER

or

x.Set "LDAP://server/dc=domain1,dc=Fabrikam,dc=com", ADS_SETTYPE_FULL
MsgBox "Path in Windows Format: " & x.Retrieve(ADS_FORMAT_WINDOWS)

The following VBScript/ASP code example shows how to create an IADsPathname object.

<%
Dim x 
Set x = CreateObject("Pathname")
x.Set "LDAP://server/dc=domain1,dc=Fabrikam,dc=com", ADS_SETTYPE_FULL
winPath = x.Retrieve(ADS_FORMAT_WINDOWS)
Response.Write "Path in Windows Format: " & winPath
%>

The following C++ code example shows how to create an IADsPathname object.


IADsPathname *GetPathnameObject(LPWSTR adsPath)
{
   if(!adsPath) return NULL;
 
   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;
   }
 
   pPathname->AddRef();
   hr = pPathname->Set(CComBSTR(adsPath), ADS_SETTYPE_FULL); 
 
   return pPathname;
}

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Iads.h

DLL

Activeds.dll

IID

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

See also

IADsPathname Property Methods
ADS_FORMAT_ENUM
ADS_SETTYPE_ENUM
CoCreateInstance()

 

 

Show:
© 2014 Microsoft