The LotusScript NotesRegistration class provides a way to register new users. The RegisterNewUser method in the class, in addition to properties within the class, are used to accomplish the registration. The RegisterNewUser method can create an ID file for the new user, create a mail file, and add a Person Document to the Domino Directory.
The syntax of the RegisterNewUser method is as follows (see Supporting Information below for additional details):
notesRegistration.RegisterNewUser( lastname$, idfile$, mailserver$ [, firstname$ [, middle$ [, certpw$ [, location$ [, comment$ [, maildbpath$ [, fwddomain$ [, userpw$ [, usertype% [, altname [, altnamelang ]]]]]]]]]]] )
NOTE: The MailServer$ parameter must be passed in full canonical format (such as CN=ServerA/OU=West/O=Widgets). If you attempt to send mail to users who were registered without the MailServer in canonical format, the following error can occur: "No route found to server X/Org from server X/Org: check server and connection documents in Name and Address Book."
The following properties in the NotesRegistration class must be set prior to calling the RegisterNewUser method:
NOTE: Details on each property can be found in the Domino Designer Online Help.
The following sample LotusScript code demonstrates how to use the method. Replace the text in brackets <> with the information specific to your environment. It could potentially be adapted to loop through an array or text file for batch processing.
Dim Session As New NotesSession
Dim db As NotesDatabase
Dim NR As New NotesRegistration
Dim UseridFile As String
Dim Lname As String
Dim Fname As String
Dim MailServer As String
Dim Mlocation As String
Dim UserPassword As String
Dim UserMailPath As String
Dim CertPassword As String
Dim Comment As String
NR.StoreIDinAddressBook = True
NR.CreateMailDB = True
NR.UpdateAddressBook = True
NR.IDType = ID_HIERARCHICAL
'PARAMETERS TO CODE:
NR.Expiration = Now() + (365 * 2)
NR.certifieridfile = ""
NR.OrgUnit = ""
MailServer = "" 'Must use full canonical version of name.
FName = ""
MName = ""
LName = ""
UserPassword = ""
UserIDFile = "" 'May also use: =Trim(Left(FName,1)+LName)
UserMailPath = "\" * useridfile
Mlocation = ""
Comment = "This entry added via agent on date x/y/z" 'As desired
If NR.RegisterNewUser(LName, UserIDFile, MailServer, FName, Mname , CertPassword, MLocation, Comment, UserMailPath, , UserPassword) Then
Msgbox("User was Registered Successfully")
Msgbox("Sorry, User was Not Registered, Please try again")
From the Domino Designer Online Help entry on the RegisterNewUser method (of the NotesRegistration class):
Creates a user ID and optionally adds it to a Domino Directory.
variant = notesRegistration.RegisterNewUser( lastname$, idfile$, mailserver$ [, firstname$ [, middle$ [, certpw$ [, location$ [, comment$ [, maildbpath$ [, fwddomain$ [, userpw$ [, usertype% [, altname [, altnamelang ]]]]]]]]]]] )
String. The last name of the user to be registered.
String. The ID file to be created; specify the complete path, for example, c:\notes\data\user.id.
String. The canonical name of the server containing the user's mail file.
String. A first name for the user.
String. A middle initial for the user.
String. The password of the certifier ID file.
String. A value for the location field in the Domino Directory record.
String. A value for the comment field in the Domino Directory record.
String. The path of the user's mail file relative to the mail directory; for example, mail\jones.nsf.
String. The forwarding domain for the user's mail file.
String. A password for the user ID file.
Note: This parameter is new with Release 5.
Constant of type Integer. Indicates the type of client to be created. May be one of the following.
NOTES_DESKTOP_CLIENT (175) Desktop client
NOTES_FULL _CLIENT (176) Default, full client
NOTES_LIMITED_CLIENT (174) Mail client
Note: This parameter is new with Release 5.0.2.
String. An alternate user name.
Note: This parameter is new with Release 5.0.2.
String. The language for the alternate user name. See @Locale in the formula language for a list of language codes.
Before calling this method, set CertifierIDFile, Expiration (defaults to 2 years from now), IDTyle, and MinPasswordLength.
Change - Expiration now takes default.
Note: The expiration default is new with Release 6.0.3.
Set UpdateAddressBook True to add a Server record to the Domino Directory. Set StoreIDInAddressBook True to attach the ID to the Domino Directory record. These operations can be performed separately with AddUserToAddressBook.
Set OrgUnit to add an organizational unit to the ID name. Optionally set AltOrgUnit and AltOrgUnitLang.
Optionally set IsNorthAmerican and RegistrationLog.
This method acts on the Domino Directory (names.nsf) for the server specified by RegistrationServer, or names.nsf in the local Domino data directory if this property is not set.