GetObjectEx Method

This method returns the IDispatch interface to the user's ADSI object as defined by the specified AUO entry name passed as an argument.

IDL Definition

HRESULT GetObjectEx(
[in]         BSTR         bszEntryName,
[out,retval] IDispatch**  ppEntry
);

Parameters

bszEntryName

The name of the AUO entry. (the AUO alias)

ppEntry

Upon return, the IDispatch interface to the ADSI object.

Return Value

a standard HRESULT value

Remarks

Since each Membership virtual server instance has its own set of AUO entries defined, the Init method must be called before GetObjectEx.

GetObjectEx is marked in its IDL definition as [id(DISPID_VALUE)]. This means that this method is the default method for the object. If no method is specifies when IDispatch::Invoke is called, the object defaults to invoking GetObjectEx.  This is nice for languages such as VBscript as a shorthand to avoid extra typing:

UserObject("this")  is the same as UserObjects.GetObjectEx("this").  That is, they invoke the same method using "this" as an argument.

Example

VBScript in an ASP Page

<% 
 Set IUserObjects = Server.CreateObject("Membership.UserObjects")
 Set IadsiObj = IUserObjects("AUOAlias")
 Response.write "Hello " & IadsObj.givenName
%>

In this example, the givenName user propert is fetched from the user ADSI object using the configuration information for the AUO entry named "AUOAlias".  Note also that one need not explicitly type out GetObjectEx as it is the default method for the dispinterface for IUserObjects.


© 1997-1998 Microsoft Corporation. All rights reserved.