Microsoft Identity Integration Server 2003 Developer Reference

Example: Contact

The following example shows how to provision an object for a Lotus Notes connected data source for a contact:

[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 DNName As String

	If mventry("EmployeeStatus").IsPresent _
		AndAlso mventry("EmployeeStatus").Value.Equals("active") Then

		ManagementAgent = mventry.ConnectedMAs("Lotus Notes MA")
		Connectors = ManagementAgent.Connectors.Count

		If 0 = Connectors Then

			csentry = ManagementAgent.Connectors.StartNewConnector("person")
			DNName = mventry("sn").Value

			If mventry("middleName").IsPresent Then
				DNName = mventry("middleName").Value + " " + DNName
			End If

			If mventry("givenName").IsPresent Then
				DNName = mventry("givenName").Value + " " + DNName
			End If

			'  Set the property values to provision the object.
			csentry.DN = ManagementAgent.EscapeDNComponent(DNName).Concat("NAB=names.nsf")
			csentry("_MMS_IDRegType").IntegerValue = 0  ' Contact

			'  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;
	string DNName;

	if(mventry["EmployeeStatus"].IsPresent)
	{
		if(mventry["EmployeeStatus"].Value.Equals("active"))
		{
			ManagementAgent = mventry.ConnectedMAs["Lotus Notes MA"]; 
			Connectors = ManagementAgent.Connectors.Count;

			if(0 == Connectors)
			{
				csentry = ManagementAgent.Connectors.StartNewConnector("person");
				DNName = mventry["sn"].Value; 

				if(mventry["middleName"].IsPresent)
				{
					DNName = mventry["middleName"].Value + " " + DNName;
			}			

				if(mventry["givenName"].IsPresent)
				{
					DNName = mventry["givenName"].Value + " " + DNName;
			}
			
				// Set the property values to provision the object.
				csentry.DN = ManagementAgent.EscapeDNComponent(DNName).Concat("NAB=names.nsf");
				csentry["LastName"].Value = mventry["sn"].Value;
				csentry["_MMS_IDRegType"].IntegerValue = 0;  // Contact

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

See Also

Lotus Notes Connected Data Sources, Lotus Notes Properties