This method attempts to bind a specified ADSI object, and if successful, returns the IDispatch address of the object. The authentication procedure is the same as normally used by the class UserObjects object when binding ADSI objects.
IDL Definition
HRESULT GetObjectAsUser(
[in] BSTR bszADsPath,
[out,retval] IDispatch** ppObject
);
Parameters
bszADsPath
The ADSI path to an object.
ppObject
Upon return, the IDispatch interface to the ADSI object.
Return Value
a standard HRESULT value
Remarks
This method differs from IADsContainer GetObject or IUserObjects GetObjectEx in that it returns any accessible ADSI object, rather than an object located in one of the containers defined by the AUO entries.
Example
VBScript in an ASP page
<% Set IUserObjects = Server.CreateObject(“Membership.UserObjects”)
Set IContainer = IUserObjects.GetObjectAsUser(“LDAP://someserver/ou=groups/o=company”)
For Each IItem in IContainer
Response.write “Item’s Name: “ & IItem.Name & “<br>”
Response.write “Item’s ADsPath: “ & IItem.AdsPath & “<br>”
Next