IADsPathname::CopyPath method (iads.h)

The IADsPathname::CopyPath method creates a copy of the Pathname object.

Syntax

HRESULT CopyPath(
  [out] IDispatch **ppAdsPath
);

Parameters

[out] ppAdsPath

The IDispatch interface pointer on the returned IADsPathname object.

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.

Remarks

This method is used to modify the object path and retain the original object path.

Examples

The following Visual Basic code example shows how to make a copy of a pathname.

Dim x, y As New Pathname
x.Set "LDAP://srv1/dc=dom,dc=company,dc=com",ADS_SETTYPE_FULL
set y = x.CopyPath
MsgBox y.Retrieve(ADS_FORMAT_WINDOWS)

The following VBScript/ASP code example shows how to make a copy of a pathname.

<%
Dim x, y
Const ADS_SETTYPE_FULL = 1
Const ADS_FORMAT_WINDOWS = 1
Set x = CreateObject("Pathname")
x.Set "LDAP://srv1/dc=dom,dc=company,dc=com",ADS_SETTYPE_FULL
 
set y = x.CopyPath
Response.Write y.Retrieve(ADS_FORMAT_WINDOWS)
%>

The following C++ code example creates a copy of a pathname object. For more information and a code example of the GetPathnameObject function, see IADsPathname.

IADsPathname *pPath;
LPWSTR adsPath;
adsPath = L"LDAP://server/cn=jeff smith,dc=Fabrikam,dc=com";
 
IADsPathname *pPath = GetPathnameObject(adsPath)
if (!pPath) exit(0);
 
IDispatch *pDisp;
HRESULT hr;
hr = pPath->CopyPath(&pDisp);
if(FAILED(hr)) exit(hr);
 
IADsPathname *pPathCopy;
hr = pDisp->QueryInterface(IID_IADsPathname,(void**)&pPathCopy);
 
// ...

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header iads.h
DLL Activeds.dll

See also

ADSI Error Codes

IADsPathname