Share via


Example: Provisioning a Lotus Notes User with a Mail File Created by the AdminP Process

The following Visual Basic .NET and C# examples show how to provision an object for a user in an organizational unit. The _MMS_UseAdminP property is set to true to create the e-mail account from the AdminP process. The mail template is specified in the _MMS_MailTemplateName property value. The number of days before the certificate expires is set to 5. The mail size limit is set to 4 MB, and the mail warning threshold is set to 3 MB. The mail template file is statrep5.ntf.

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.

Important  Change the value of the _MMS_Password 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 CSEntry.DN 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.

The following Visual Basic .NET and C# examples show how to provision an object for a user in an organizational unit.

Imports Microsoft.MetadirectoryServices

Public Class MVExtensionObject
    Implements IMVSynchronization

    Public Sub Initialize() Implements IMvSynchronization.Initialize
        ' TODO: Add initialization code here
    End Sub

    Public Sub Terminate() Implements IMvSynchronization.Terminate
        ' TODO: Add termination code here
    End Sub

    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
                csentry("_MMS_IDRegType").IntegerValue = 1  ' US User
                csentry("_MMS_IDStoreType").IntegerValue = 1  ' ID File as an attachment
                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

                ' The value of the _MMS_UseAdminP property by default 
                ' is "false". If true, the provisioned users' specified
                ' mailfile will be created by the AdminP process on the 
                ' Notes server. If false, the mailfile is created with the
                ' Notes user (i.e. ILM 2007 FP1 3.0 RTM behavior). 
                csentry("_MMS_UseAdminP").BooleanValue = True

                ' The _MMS_MailTemplateName property indicates the mail 
                ' template file to use when creating the users' mail 
                ' file. If specified, the mail file is created using the 
                ' template; if it is not specified, the default mail
                ' template file is used to create the mailfile
                csentry("_MMS_MailTemplateName").Value = "statrep5.ntf"

                ' The _ MMS_CertDaysToExpire property is a string that 
                ' indicates the number of days from today's date until the
                ' certificates expiration date. The default value is 2 years
                ' (current hardcoded behavior)
                csentry("_MMS_CertDaysToExpire").Value = "5"

                ' _MMS_MailQuotaSizeLimit is a string 
                ' indicating the number of megabytes for the
                ' mailfile database size quota.
                csentry("_MMS_MailQuotaSizeLimit").Value = "4"

                ' _MMS_MailQuotaWarningThreshold is a 
                ' string that indicates the number of megabytes
                ' before the warning is issued. 
                csentry("_MMS_MailQuotaWarningThreshold").Value = "3"

                '  Finish creating the new connector.
                csentry.CommitNewConnector()
            End If
        End If
    End Sub

    Public Function ShouldDeleteFromMV(ByVal csentry As CSEntry, _
              ByVal mventry As MVEntry) As Boolean Implements IMVSynchronization.ShouldDeleteFromMV
        ' TODO: Add MV deletion code here
        Throw New EntryPointNotImplementedException()
    End Function
End Class

using System;
using Microsoft.MetadirectoryServices;

namespace Mms_Metaverse
{
    // summary
    // Summary description for MVExtensionObject.
    // summary
    public class MVExtensionObject : IMVSynchronization
    {
        public MVExtensionObject()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        void IMVSynchronization.Initialize ()
        {
            //
            // TODO: Add initialization logic here
            //
        }

        void IMVSynchronization.Terminate ()
        {
            //
            // TODO: Add termination logic here
            //
        }

        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;
                        csentry["_MMS_IDRegType"].IntegerValue = 1;  // US User
                        csentry["_MMS_IDStoreType"].IntegerValue = 1;  // ID File as an attachment
                        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;

                        // The value of the _MMS_UseAdminP property by default 
                        // is false. If "true" then it will cause the 
                        // provisioned user's specified mailfile to be created
                        // by the AdminP process on the Notes server. If 
                        // not specified, the mailfile is created together with 
                        // the Notes user(i.e. ILM 2007 FP1 3.0 RTM behavior)
                        csentry["_MMS_UseAdminP"].BooleanValue = true;

                        // The _MMS_MailTemplateName property indicates the 
                        // mail template file to use when creating the users 
                        // mail file. If specified, the mail file is created
                        // using the template, if it is not specified, the 
                        // default mail template file is used to create 
                        // the mailfile.
                        csentry["_MMS_MailTemplateName"].Value = "statrep5.ntf";

                        // The _ MMS_CertDaysToExpire property is a string 
                        // that indicates the number of days from today's date
                        // for the certificates to expire. The default is 2 
                        // years (current hardcoded behavior).
                        csentry["_MMS_CertDaysToExpire"].Value = "5";

                        // _MMS_MailQuotaSizeLimit - The string number of
                        // megabytes for the mailfile database size quota.
                        csentry["_MMS_MailQuotaSizeLimit"].Value = "4";

                        // _MMS_MailQuotaWarningThreshold - The string number 
                        // of megabytes before the warning is issued.
                        csentry["_MMS_MailQuotaWarningThreshold"].Value = "3";

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

        bool IMVSynchronization.ShouldDeleteFromMV (CSEntry csentry, MVEntry mventry)
        {
            //
            // TODO: Add MV deletion logic here
            //
            throw new EntryPointNotImplementedException();
        }
    }
}

See Also

Lotus Notes Connected Data Sources
Lotus Notes Properties

Send comments about this topic to Microsoft

Build date: 2/16/2009