Microsoft Identity Integration Server 2003 Developer Reference

Example: Connected Data Sources that Expect Identity Integration Server to Provide the Anchor Attributes

Certain connected data sources expect that when objects are exported, they will have anchor attributes. When exporting objects into data sources that expect anchor attributes, use Identity Manager to configure attributes as anchor attributes. For more information about configuring anchor attributes, see "Configure attributes" in Microsoft Identity Integration Server 2003 Help.

The following example shows how to provision objects for connected data sources that expect anchor attributes:

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

   Dim ManagementAgent As ConnectedMA  ' Management agent object
   Dim Connectors As Integer		 ' Number of connectors under this 
									 ' management agent
   Dim Anchor As String				' Anchor attribute string
   Dim csentry As CSEntry			' Connector space entry object

	' Determine the state of the metaverse object.
	If mventry("employeeID").IsPresent _
		AndAlso mventry("employeeStatus").IsPresent _
		AndAlso mventry("employeeStatus").Value.Equals("active") Then

		' Get the management agent
		ManagementAgent = mventry.ConnectedMAs("Primary Key Data Source MA")

		' Get the number of connectors for this MVEntry object under
		' this management agent.
		Connectors = ManagementAgent.Connectors.Count

		' Construct an anchor based on a metaverse object attribute.
		Anchor = mventry("employeeID").Value

		If 0 = Connectors Then
			' Create a new connector.
			csentry = ManagementAgent.Connectors.StartNewConnector("person")

			' Set the anchor attribute configured on this management agent.
			csentry("employeeID").Value = Anchor

			' Add the connector to the connector collection.
			csentry.CommitNewConnector()

		ElseIf 1 = Connectors Then
			' If the connector already exists and you want to use
			' this connector, remove the comment from the following line and 
			' add your code.
			' csentry = ManagementAgent.Connectors.ByIndex(0)

		Else
			Throw New UnexpectedDataException("Multiple connectors on the management agent.")
		End If

	End If
End Sub
[C#]
void IMVSynchronization.Provision (MVEntry mventry)
{
	ConnectedMA ManagementAgent; // Management agent object
	int Connectors; 			 // Number of connectors under this 
									// management agent
	string Anchor; 			// Anchor attribute string
	CSEntry csentry; 			// Connector space entry object

	// Determine the state of the metaverse object.
	if (mventry["employeeID"].IsPresent && 
		mventry["employeeStatus"].IsPresent && 
		mventry["employeeStatus"].Value.Equals("active"))
	{
		// Get the management agent
		ManagementAgent = mventry.ConnectedMAs["Primary Key Data Source MA"];

		// Get the number of connectors for this MVEntry object under
		// this management agent.
		Connectors = ManagementAgent.Connectors.Count;

		// Construct an anchor based on a metaverse object attribute.
		Anchor = mventry["employeeID"].Value;

		if(0 == Connectors)
		{
			// Create a new connector.
			csentry = ManagementAgent.Connectors.StartNewConnector("person");

			// Set the anchor attribute configured on this management agent.
			csentry["employeeID"].Value = Anchor;

			// Add the connector to the connector collection.
			csentry.CommitNewConnector();
	}

		if (1 == Connectors)
		{
			// If the connector already exists and you want to use
			// this connector, remove the comment from the following line and 
			// add your code.
			// csentry = ManagementAgent.Connectors.ByIndex(0)
	} 

		else
		{
			throw new UnexpectedDataException("Multiple connectors on the management agent.");
	}
}

}

See Also

Provisioning Objects in the Connector Space, ConnectorCollection.StartNewConnector, CSEntry, CSEntry.CommitNewConnector