The following example shows how to provision an object for a
Lotus Notes connected data source for a contact.
Note: |
In Lotus Notes, you can provision contacts for the primary or
secondary address book. Contacts are created with the Lotus Notes
_MMS_IDRegType property set to 0. Users, created with the
_MMS_IDRegType property set to 1 or 2, cannot be provisioned
for the secondary address book. Because Groups are not created as
objects, you can provision them to the primary or secondary address
book. |
Visual Basic |
Copy Code |
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# |
Copy Code |
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