Directory Services

IADsPathname::CopyPath

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

HRESULT CopyPath( 
  IDispatch** ppAdsPath
);

Parameters

ppAdsPath
[out] The IDispatch interface pointer on the returned ADsPathname object.

Return Values

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

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

Return Code Description
S_OK The operation is successful.
E_FAIL The operation has failed.
E_INVALIDARG The user has supplied an undefined parameter.

Remarks

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

Example Code [Visual Basic]

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)

Example Code [VBScript]

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)
%>

Example Code [C++]

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);
 
// &#8230;

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

IADsPathname, ADSI Error Codes