Previous in Contents Next in Contents

Class SchemaObjects

Programmatic Identifier

Membership.SchemaObjects.1

CLSID

40E9AD64-E2A1-11D0-920F-00C04FB954C7

COM Class Name

SchemaObjects

Type Library Name

AUO 1.0 Type Library

Type Library Location

c:\Microsoft Site Server\bin\P&M\auo.dll

Threading Model

“Both”

The SchemaObjects class defines a COM object that can be used to access ADSI objects that define the schemas for users in various directory services.  Objects of this class use predefined Active User Object (AUO) entries to bind the appropriate ADSI schema objects. These schema objects are ADSI objects that provide connectivity and cacheing services for the data stored for the schema definitions.

An exhaustive discussion of working with the schemas defining directory service databases is beyond the scope of this reference.  For more information about schema definitions, directory service use, and the Active Directory Service Interfaces (ADSI), see the ADSI 2.0 documentation that can be found in the Platform SDK on the Microsoft Developer's Network.

In order for objects of this class to operate correctly, the Active User Objects (AUO) entries for the desired Membership Authentication server instance must have been previously configured.  For more information about configuring the AUO entries for a Membership Authentication server instance, see the AuoConfig Class reference.

Interfaces

The SchemaObjects class exposes the following dual interfaces:

IADs

IADsContainer

IADsClass

ISchemaObjects

Interface IADs

The IADs interface exposed by the SchemaObjects class is a strictly contained interface on an associated ADSI object.  This interface is covered in detail in the ADSI 2.0 SDK documentation that can be found on the Microsoft Developer's Network.  It is under the Platform SDK in the Network and Distributed Services sub-section.  The properties and methods exposed with this interface are listed below for convenience.

Properties

Name Description
Name Gets the object's relative name.
Class Gets the object's schema class name.
GUID Gets the object's globally unique identifier.
ADsPath Gets the object's ADsPath that uniquely identifies this object from all others.
Parent Gets the object's ADsPath string for its parent container.
Schema Gets the ADsPath string to the schema class definition object for this object.

Methods

Name Description
GetInfo Reloads the property values for this object as they exist in the underlying directory service.
SetInfo Saves the changes on this object and its dependents.
Get Gets the value for a property by name.
Put Sets the value for a property by name.
GetEx Gets the value for a single or multi-valued property by name.
PutEx Sets the value for a single or multi-valued property by name.
GetInfoEx Reloads specific property values for this object as they exist in the underlying directory service.

Interface IADsContainer

The IADsContainer interface exposed by the SchemaObjects class is a strictly contained interface on an associated ADSI object.  This interface is covered in detail in the ADSI 2.0 SDK documentation that can be found on the Microsoft Developer's Network.  It is under the Platform SDK in the Network and Distributed Services sub-section.  The properties and methods exposed with this interface are listed below for convenience.

Properties

Name Description
Count (RO) Gets the number of Schema objects defined by the current set of AUO provider definitions.
_NewEnum (RO) Get interface on an enumerator object.  This enumerator will step through all the Schema objects defined by the current set of AUO provider definitions.
Filter Not implemented.
Hints Not implemented.

Methods

Name Description
GetObject Gets an interface on a named object. This name must be an AUO provider alias. The ADSI object loads will have Ads path equal to the path defined in the AUO provider under the name Schema.
Create Not implemented.
Delete Not implemented.
CopyHere Not implemented.
MoveHere Not implemented.

Interface IADsClass

The IADsClass interface exposed by the SchemaObjects class is a strictly contained interface on an associated ADSI object.  This interface is covered in detail in the ADSI 2.0 SDK documentation that can be found on the Microsoft Developer's Network.  It is under the Platform SDK in the Network and Distributed Services sub-section.  The properties and methods exposed with this interface are listed below for convenience.

Properties

Name Description
IID Interface identifer.
IOD Directory service-specific Object Identifier.
Abstract Whether or not this schema class is abstract.
Auxiliary Whether or not this schema class is auxiliary.
MandatoryProperties List of required properties needed before saving this object.
OptionalProperties List of optional properties for this object.
NamingProperties List of naming attributes for this object.
DerivedFrom Immediate superclasses of this schema class.
AuxDerivedFrom Immediate superclasses of this schema class.
PossibleSuperiors List of classes that can contain instances of this class.
Containment Legal objects types that can be contained within this container.
Container Whether or not this is a container object.
HelpFilename Optional help file name.
HelpFileContext Optional help file context ID.

Methods

Name Description
Qualifiers Optional collection of provider-specific qualifiers for this property.

ISchemaObjects Interface

The ISchemaObjects interface exposes a dual interface.  Therefore, clients can access the methods either through the associated dispinterface (through IDispatch* implementation) or as a pure COM interface.

The methods this interface provides are listed below, along with the implementation presented by the SchemaObjects COM class.

BindAs

The BindAs method sets the ADSI binding credentials used when binding to ADSI objects defined by the specified Active User Object (AUO) provider alias.

IDL Definition

[id(5)] HRESULT BindAs(
BSTR bszAlias,
BSTR bszUserName,
BSTR bszPassword
);

Parameters

bszAlias

The AUO alias to set binding credentials for.

bszUserName

The name to use when binding.  This name should be a distinguished name. (e.g. "c=us/o=comp/ou=admin/cn=admin")

bszPassword

The password to use when binding.

Return Values

a standard HRESULT value.

Remarks

The Init or InitEx method must be called first before any other methods are invoked on objects of class SchemaObjects.  If one uses the built-in ASP object Server to create the object via its CreateObject method, Init is called automatically in the ISchemaObjects OnStartPage callback method invoked by the ASP scripting context.

The BindAs method can only be invoked prior to any binding of ADSI objects.  If an ADSI object has been bound, the method will return a COM exception.

One can permanently set the binding credentials using the BindAsName and BindAsPassword values for the AUO provider definition.

Example

ASP and VBScript

<%
Set ISchemaObjects = Server.CreateObject("Membership.SchemaObjects")
BindUser = "c=US/o=company/ou=members/cn=Administrator"
BindPwd = "password"
call ISchemaObjects.BindAs( BindUser, BindPwd )
%>

See Also

Init

Class AuoConfig

Init

This method initializes the object with an Internet Information Server instance identifier. This identifier is used to map to the associated Membership server instance and the AUO entries defined for it.

IDL Definition

HRESULT Init( BSTR bszHostName ) ;

Parameters

bszHostName

The Internet Information Server instance identifier.

Return Values

a standard HRESULT value.

Remarks

The Init method is automatically called if the built-in ASP Server object is used to create the instance of the SchemaObjects COM class via the CreateObject method.  This is done in the ISchemaObjects OnStartPage method which is called by the ASP scripting context after the instance is created.

Example

VBScript in an ASP script

<%
Set ISchemaObjects = Server.CreateObject("Membership.SchemaObjects")
'  init called automatically
%>

Alternately, we can call this method ourselves:

<% Set ISchemaObjects = CreateObject("Membership.SchemaObjects")
   call IschemaObjects.Init(2) ' IIS virt server 3

Note that in the first example, the Server object method CreateObject is used to create the instance.  The scripting context automatically invokes ISchemaObjects OnStartPage that in turn invokes the Init method.

See Also

OnStartPage

InitEx

The InitEx method initializes the object with a Internet Information Server instance identifier and a boolean flag specifying whether a login credentials prompt should be presented to the user.

IDL Definition

HRESULT InitEx(
[in] BSTR bszHostName,
[in] VARIANT_BOOL fPromptCredentials
);

Parameters

bszHostName

The Internet Information Server instance identifier

fPromptCredentials

A flag specifying whether to prompt the user for credentials.

Return Values

a standard HRESULT value

Remarks

This method is identical to the Init method except that it allows the Credentials flag to be set.  This flag is meaningful in the following situations:

 In this case, an interactive user (not a web user) will be prompted with a standard dialog box whenever they attempt to load a specific ADSI schema object defined by one of the AUO provider definitions.   The dialog asks whether they want to log on anonymously or specify a username and password.  The name they specify should be a username in the corresponding Membership Directory Service.

Avoid using the InitEx method within ASP pages.   Simply create the object using the Server.CreateObject method.  This will automatically call the Init method for you.

Example

Visual Basic 5.0 (stand alone EXE)

Dim SchemaObj as SchemaObjects
Set SchemaObj = new SchemaObjects

SchemaObj.InitEx “3”, TRUE

Dim IADs as IADs
Dim List as Variant  ‘ an array

Set IADs = SchemaObj

List = IADs.Get(“mustContain”)   ‘ this causes the schema defined for the 
                                 ‘  default AUO provider to be loaded
                                 ‘  However…
‘  AT THIS POINT, the interactive user running the VB app would
‘  be presented with a login dialog.  In order to proceed, they would
‘  have to authenticate against the membership directory service 
‘  database.

‘… go on to use the schema object

GetEntrySchemaPath

This method returns the value set in the specified Active User Object (AUO) provider definition under the name Schema.

IDL Definition

HRESULT GetEntrySchemaPath(
[in]          BSTR  bszEntryName,
[out, retval] BSTR* pbszSchemaPath
);

Parameters

bszEntryName

The name of the AUO provider

pbszSchemaPath

On return, the ADSI path to the schema object.

Return Values

a standard HRESULT value

Remarks

This value is fetched directly from the AUO provider definition under the name Schema.  See the AuoConfig class for information about how to set this value.

Example

VBScript in an ASP script

<%
Set ISchemaObjects = Server.CreateObject("Membership.SchemaObjects")
' the default AUO entry schema path
DefPath = ISchemaObjects.GetEntrySchemaPath("") 

' a named AUO entry schema path
Path2 = ISchemaObjects.GetEntrySchemaPath("SomeAUOAlias")
%>

See Also

Class AuoConfig

GetRelativeName

The GetRelativeName method returns the AUO provider name for the object whose current IUnknown interface address is passes as the first argument.

IDL Definition

HRESULT GetRelativeName(
[in]          IUnknown* pUnk,
[out, retval] BSTR*     pbszName
);

Parameters

pUnk

The IUnknown interface to the ADSI schema object.

pbszName

On return, the relative name of the object.

Return Values

a standard HRESULT value

OnStartPage

The OnStartPage method is automatically invoked when the Server object is used to create an instance of the SchemaObjects class.  When invoked, the Init method is invoked, and the current Internet Information Server instance identifier is passed.  This is the instance identifier that can be fetched in an ASP environment using the Request object ServerVariables collection under the key INSTANCE_ID.

Example

<% Set oSchemaObjects = Server.CreateObject(“Membership.SchemaObjects”) %>
‘  in this case, the OnStartPage is called by the scripting context automatically
‘  so one need not invoke Init explicitly.

OnEndPage

This method is automatically invoked by the ASP scripting context when the Server object is used to create an instance of the SchemaObjects class.   It performs any necessary memory de-allocations and reference releases to held interfaces.


© 1997-2000 Microsoft Corporation. All rights reserved.