Partager via


How to: Provision Lotus Notes Users in Organizational Units

The following examples show how to provision an object for a user in an organizational unit. The organizational unit is "accounting". The identification file is stored as an attachment, and the password for the identification file is "FilePassword". The user accesses e-mail through the Lotus Notes client.

Note

Change the value of the Lotus Notes Properties property to a different value than the value that is shown in the code example.

If you are referencing a file that is located in a folder for the DN property value, such as the file for the Notes Address Book (NAB) value, use a forward slash (/) to separate the folder name from the file name: for example, folder/file name.

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
    Dim DNCertifier As String = "O=Main"

    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

            DNName = DNName + "/" + DNCertifier

            ' Set the property values to provision the object.
            csentry.DN = ManagementAgent.EscapeDNComponent("CN=" _
                            + DNName).Concat("NAB=names.nsf")

            csentry("LastName").Value = mventry("sn").Value
            csentry("_MMS_Certifier").Value = DNCertifier

            ' "1" indicates a United States User
            csentry("_MMS_IDRegType").IntegerValue = 1
            
            ' "1" indicates the ID File is an attachment  
            csentry("_MMS_IDStoreType").IntegerValue = 1  
            csentry("_MMS_OU").Value = "accounting"  ' Organizational Unit is accounting

            ' The next property must have a value for a user with an
            ' identification file.
            csentry("_MMS_Password").Value = "FilePassword"

            ' The next two properties must have a value for a user to access
            ' e-mail through the Lotus Notes client.
            csentry("MailServer").Value = "CN=DominoServer/O=DominoDomain"

            csentry("MailFile").Value = "mail\" & mventry("uid").Value

            '  Finish creating the new connector.
            csentry.CommitNewConnector()

        End If

    End If

End Sub
void IMVSynchronization.Provision (MVEntry mventry)
{
    ConnectedMA ManagementAgent;
    int Connectors;
    CSEntry csentry;
    string DNName;
    string DNCertifier = "O=Main";

    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;
                }                

                DNName = DNName + "/" + DNCertifier;
            
                // Set the property values to provision the object.
                csentry.DN = ManagementAgent.EscapeDNComponent("CN="
                                + DNName).Concat("NAB=names.nsf");

                csentry["LastName"].Value = mventry["sn"].Value;
                csentry["_MMS_Certifier"].Value = DNCertifier;
                
                // "1" indicates a United States user
                csentry["_MMS_IDRegType"].IntegerValue = 1;

                // "1" indicates that the ID File is an attachment
                csentry["_MMS_IDStoreType"].IntegerValue = 1;  
                csentry["_MMS_OU"].Value = "accounting";  // Organizational Unit is accounting

                // The next property must have a value for a user with an
                // identification file.
                csentry["_MMS_Password"].Value = "FilePassword";  

                // The next two properties must have a value for a user to 
                // access e-mail through the Lotus Notes client.
                csentry["MailServer"].Value = "CN=DominoServer/O=DominoDomain";
                csentry["MailFile"].Value = @"mail\" + mventry["uid"].Value;

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

See Also

Concepts

Lotus Notes Connected Data Sources

Other Resources

Lotus Notes Properties