Microsoft Identity Integration Server 2003 Developer Reference

Example: Changing the ObjectClass Property

The following example shows how to change the value of the ObjectClass property of a CSEntry object. You can write to the ObjectClass property only in the IMVSynchronization.Provision method.

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

	Dim ManagementAgent As ConnectedMA
	Dim Connectors As Integer
	Dim csentry As CSEntry
	Dim vcObjectClass As ValueCollection


	ManagementAgent = mventry.ConnectedMAs("Some Management Agent")
	Connectors = ManagementAgent.Connectors.Count

	If 1 = Connectors Then

		' Use the existing connector
		csentry = ManagementAgent.Connectors.ByIndex(0)

		' Convert the existing ObjectClass entries to a string array
		vcObjectClass = Utils.ValueCollection(csentry.ObjectClass.ToStringArray())

		' Add the auxiliary class to the string array and then
		' set the ObjectClass to the modified string array
		vcObjectClass.Add("new-aux-class")
		csentry.ObjectClass = vcObjectClass

	End If

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

	ManagementAgent = mventry.ConnectedMAs["Some Management Agent"];
	Connectors = ManagementAgent.Connectors.Count;

	if(1 == Connectors)
	{
		// Use the existing connector
		csentry = ManagementAgent.Connectors.ByIndex[0];
	
		// Convert the existing ObjectClass entries to a string array.
		vcObjecClass = Utils.ValueCollection(csentry.ObjectClass.ToStringArray());
	
		// Add the auxiliary class to the string array and then
		// set the ObjectClass to the modified string array.
		vcObjecClass.Add("new-aux-class");
		csentry.ObjectClass= vcObjecClass;
}
}

See Also

CSEntry, CSEntry.ObjectClass, IMVSynchronization.Provision, Provisioning Objects in the Connector Space