Microsoft Identity Integration Server 2003 Developer Reference

Example: Microsoft Windows NT Server 4.0 Connected Data Sources

Microsoft Identity Integration Server 2003 supports provisioning connector space object for users and global groups in Microsoft Windows NT® Server 4.0.

To provision a connector space object for a user, you have to set the flags attribute of the connector space entry object to a value for a user account feature. For more information, see the usri1_flag member of the USER_INFO_1 structure in the Platform SDK.

The following example shows how to provision objects for Windows NT Server 4.0 connected directories:

[Visual Basic .NET]
Public Sub Provision( _
		 ByVal mventry As MVEntry) _
	Implements IMVSynchronization.Provision

	Dim ManagementAgent As ConnectedMA
	Dim Connectors As Integer
	Dim container As String
	Dim rdn As String
	Dim dn As ReferenceValue
	Dim csentry As CSEntry

	ManagementAgent = mventry.ConnectedMAs("Windows NT MA")
	Connectors = ManagementAgent.Connectors.Count

	If 0 = Connectors Then

		If (mventry.ObjectType = "person") Then
		csentry = ManagementAgent.Connectors.StartNewConnector("user")

		' Set the property values to provision the object.
		csentry.DN = ManagementAgent.CreateDN(mventry("displayName").Value)
		' Use &H201 for an enabled user account; use &H203 for a disabled user account
		csentry("flags").IntegerValue = &H201
		' Finish creating the new connector.
		csentry.CommitNewConnector()

		ElseIf (mventry.ObjectType = "group") Then
		csentry = ManagementAgent.Connectors.StartNewConnector("group")

		' Set the property values to provision the object
		csentry.DN = ManagementAgent.CreateDN(mventry("displayName").Value)

		' Finish creating the new connector.
		csentry.CommitNewConnector()

		End If

	End If

End Sub
[C#]
void IMVSynchronization.Provision (MVEntry mventry)
{
	ConnectedMA ManagementAgent;
	int Connectors;
	CSEntry csentry;

	ManagementAgent = mventry.ConnectedMAs["Windows NT MA"];
	Connectors = ManagementAgent.Connectors.Count;

	if(0 == Connectors)

	{
		if( mventry.ObjectType == "person" )
		{
			csentry = ManagementAgent.Connectors.StartNewConnector("user"); 

			//  Set the property values to provision the object.
			csentry.DN = ManagementAgent.CreateDN( mventry["displayName"].Value );
			// ' Use 0x201 for an enabled user account; use 0x203 for a disabled user account
			csentry["flags"].IntegerValue = 0x201;

			//  Finish creating the new connector.
			csentry.CommitNewConnector();
	}
	
		else if( mventry.ObjectType == "group" )
		{
			csentry = ManagementAgent.Connectors.StartNewConnector("group"); 
		
			//  Set the property values to provision the object.
			csentry.DN = ManagementAgent.CreateDN( mventry["displayName"].Value );

			//  Finish creating the new connector.
			csentry.CommitNewConnector();
	}
}
}