Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsPathname::CopyPath method makes a copy of the Pathname object.
HRESULT IADsPathname::CopyPath( IDispatch *pDisp) );
This method supports the standard return values, as well as the following:
For other return values, see ADSI Error Codes.
This method is useful when you want to modify the object path and retain the original object path.
The following Visual Basic® code snippet 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 snippet 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 snippet makes a copy of a pathname object. The code of GetPathnameObject function used below are given in IADsPathname.
IADsPathname *pPath; LPWSTR adsPath; adsPath = L"LDAP://server/cn=john smith,dc=Microsoft,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); // …
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.