Lightweight Directory Access Protocol (LDAP)-based connected data sources require a unique distinguished name for each object. You can use the following code examples to provision the connector space for these management agents:

Visual Basic  Copy Code
Public Sub Provision( _
   ByVal mventry As MVEntry) _
   Implements IMVSynchronization.Provision

   Dim ManagementAgent As ConnectedMA  ' Management agent object
   Dim Connectors As Integer		 ' Management agent connectors
   Dim DN As ReferenceValue			' Distinguished name attribute
   Dim Container As String			 ' Container name
   Dim RDN As String				 ' Relative distinguished name strings
   Dim csentry As CSEntry			' Connector space entry object

   ' Determine the state of the <tla rid="fim_syncdb_short" /> object.   
   If mventry("EmployeeStatus").IsPresent _
	AndAlso mventry("EmployeeStatus").Value.Equals("active") Then

	' Get the management agent connectors.
	ManagementAgent = mventry.ConnectedMAs("LDAP-based MA")
	Connectors = ManagementAgent.Connectors.Count

	 ' Construct the distinguished name.
	Container = "CN=users,DC=fabrikam,DC=com"
	RDN = "CN=" & mventry("cn").Value
	DN = ManagementAgent.EscapeDNComponent(RDN).Concat(Container)

	' If there are no connectors, create the connector, set the distinguished
	' name attribute, and then add the new connector to the collection.
	If 0 = Connectors Then
		 csentry = ManagementAgent.Connectors.StartNewConnector("user")
		 csentry.DN = DN
		 csentry.CommitNewConnector()

	' If a connector exists, get the existing connector and assign the new 
	' distinguished name value. If the original attribute value is the same
	' as the new distinguished name, then the original attribute value 
	' remains the same.
	ElseIf 1 = Connectors Then
		 csentry = ManagementAgent.Connectors.ByIndex(0)
		 csentry.DN = DN

	' Throw an exception if more than one connector exists.
	Else
		 Dim ExceptionMessage As String
		 ExceptionMessage = "Multiple Connectors on Management Agent"
		 Throw New UnexpectedDataException(ExceptionMessage)
	End If

   End If

End Sub
C#  Copy Code
void IMVSynchronization.Provision(MVEntry mventry)
{
	ConnectedMA ManagementAgent;  // Management agent object
	int Connectors = 0; 	 // Management agent connectors
	ReferenceValue DN; 		// Distinguished name attribute
	string Container; 		 // Container name
	string RDN ; 			// Relative distinguished name strings
	CSEntry csentry; 		// Connector space entry object

	// Determine the state of the <tla rid="fim_syncdb_short" /> object.
	if(mventry["EmployeeStatus"].IsPresent)
	{
		if(mventry["EmployeeStatus"].Value.Equals("active"))
		{
			// Get the management agent connectors.
			ManagementAgent = mventry.ConnectedMAs["LDAP-based MA"];
			Connectors = ManagementAgent.Connectors.Count;

			// Construct the distinguished name.
			Container = "CN=users,DC=fabrikam,DC=com";
			RDN = "CN=" + mventry["cn"].Value;
			DN = ManagementAgent.EscapeDNComponent(RDN).Concat(Container);

			// If there are no connectors, create the connector, set the distinguished
			// name attribute, and then add the new connector to the collection.
			if(0 == Connectors)
			{
				csentry = ManagementAgent.Connectors.StartNewConnector("user");
				csentry.DN = DN;
				csentry.CommitNewConnector();
		}

			// If a connector exists, get the existing connector and assign the new 
			// distinguished name value. If the original attribute value is the same
			// as the new distinguished name, then the original attribute value 
			// remains the same.

			else if(1 == Connectors)
			{
				csentry = ManagementAgent.Connectors.ByIndex[0];
				csentry.DN = DN;
		}

			// Throw an exception if more than one connector exists.

			else
			{
				string ExceptionMessage; 
				ExceptionMessage = "Multiple Connectors on Management Agent";
				throw new UnexpectedDataException(ExceptionMessage);
		}
	}
}
}

See Also

Reference

StartNewConnector
EscapeDNComponent
CommitNewConnector

Concepts

Provisioning Objects in the Connector Space

Other Resources

DN

[an error occurred while processing this directive]