The SetUserName method sets the username in the object.
IDL Definition
HRESULT SetUserName( BSTR bszUserName ) ;
Parameters
bszUserName
The new username.
Return Value
a standard HRESULT value
Remarks
SetUserName may be called at any time before any ADSI objects have been bound by the UserObjects object. Once an ADSI object has been bound, the SetUserName can no longer be used.
Example
VBscript in an ASP page
<% Set IUserObjects = Server.CreateObject("Membership.UserObjects")
IUserObjects.SetUserName "KellyC"
Response.write “User Object ADs Path: “ & IUserObjects.AdsPath
Response.Write “Given Name property: “ & IUserObjects.Get(“givenName”)
In the case above, the ADSI user object with relative name “cn=KellyC” in the default AUO entry would be used, not the one sent with the HTTP request. The output would be, depending on the default AUO entry ADsPathPrefix and the properties stored in the user object:
User Object ADs Path: LDAP://someserver/o=so,ecompnay/ou=members/cn=KellyC
Given Name property: Kelly