IADsPathname::GetNumElements method

The IADsPathname::GetNumElements method retrieves the number of elements in the path.

Syntax


HRESULT GetNumElements(
  [out] long *dwNumPathElements
);

Parameters

dwNumPathElements [out]

The number of elements in the path.

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.

S_OK

The operation succeeded.

E_FAIL

The operation failed.

Examples

The following Visual Basic code example shows how to use GetNumElements.


dim x As New Pathname
x.Set = "LDAP://srv1/dc=dom,dc=company,dc=com",ADS_SETTYPE_FULL
y = x.GetNumElements()     ' y = 3.

The following VBScript code example shows how to use GetNumElements.


dim x 
Const ADS_SETTYPE_FULL = 1
Set x = CreateObject("Pathname")
x.Set = "LDAP://srv1/dc=dom,dc=company,dc=com",ADS_SETTYPE_FULL
y = x.GetNumElements()     ' y = 3.

The following C++ code example prints all the number of elements of a path. For more information and a code example of the GetPathnameObject function, see IADsPathname.


LPWSTR adsPath=L"LDAP://server/cn=jeffsmith,dc=Fabrikam,dc=com";
 
IADsPathname *pPath = GetPathnameObject(adsPath);
long count=0;
HRESULT hr = pPath->GetNumElements(&count);
printf("Count = %d\n",count);

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Iads.h

DLL

Activeds.dll

IID

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

See also

IADsPathname
ADSI Error Codes

 

 

Show: