LotusScript Classes for the Administrator
04/08/2007 11:56 AM By Keith Strickland
During my career as a Lotus Notes/Domino Administrator I've found it necessary to sometimes have to write my own agents, applications, scripts, etc. to perform certain administrative functions. These are some of the classes along with the pertinent methods and properties, of which I use most often.
Now, I'm not trying to write an entire book here, just trying to make you aware that these functions exist and can make your life MUCH easier. I'm also not going to go into a lot of detail regarding each class, method or property, just enough to get your mind working. So, here goes... Ok, I think we'll start with:
- NotesAdministrationProcess
This class is for submitting various AdminP requests. You can submit just about any AdminP request with this class. Here are some of the methods and properties that I use most:- DeleteUser
This will allow you to Delete a person from the Domino Directory.
Example:Dim adminp As NotesAdministrationProcess
Set adminp = ses.CreateAdministrationProcess(servername$)
Call adminp.DeleteUser("Joe User/Sales/Acme/US",True,2,"Access_Deny",False) - RecertifyUser
This will allow you to recertify people in the Domino Directory via an AdminP request.
Example:Dim adminp As NotesAdministrationProcess
Set adminp = ses.CreateAdministrationProcess(servername$)
adminp.CertifierFile = "c:path ocertifier.id"
adminp.CertifierPassword = certifierpassword$
Call adminp.RecertifyUser("Joe User/Sales/Acme/US") - RenameUser
Rename a person in the Domino Directory.
Example:Dim adminp as NotesAdministrationProcess
Set adminp = ses.CreateAdministrationProcess(servername$)
adminp.CertifierFile = "c:path ocertifier.id"
adminp.CertifierPassword = certifierpassword$
Call adminp.RenameNotesUser("Joe User/Sales/Acme/US",NewLastName$,NewFirstName$,NewMiddleInitial$)
- DeleteUser
- NotesDbDirectory
This class will allow you to step through a whole directory or directories of Databases and manipulate them however you like, very cool. This whole class works like stepping through documents in a view really, at least in my eyes.
Example:
dim dbdir as New NotesDbDirectory("ServerName")
dim db as NotesDatabase
Set db = dbdir.GetFirstDatabase(DATABASE)
While not db is nothing
Print db.Name
Set db = dbdir.GetNextDatabase
Wend
I didn't include the common NotesDocument, NotesView, NotesDB, NotesSession, etc classes because these are common place and you can purchase any of a dozen books to explain the use of these classes to you much better than I can explain it to you.
So, I hope this helps you folks out there that wear several hats at work and sometimes have to cross the boundries between Administrator and Developer. I'm sure a lot if not most already know of these classes and such, if so, this is probably old news, but I know these classes cut down on the amount of coding I had to do, so hopefully they will you too.
So, until next time.....
Keith
provided by Julian Robichaux at nsftools.com.











Comments
Date: 05/21/2007 12:00:51 PM
Name: Courtney Dulany
Website: http://
I agree wholeheartedly about NotesDbDirectory. By combining it with the example from Chuck Connell's Agent Installer, { Link } , I was able to easily copy two agents to every database on a server. Now everyone has the two export agents in there db and I don't have to take calls about how to install it to a db. Another under used/appreciated LotusScript class is NotesLog. Even if an Admin does not use it often, they should encourage (force?) their developers to use it in one fashion or another to help log/debug agents.
Date: 05/21/2007 02:22:36 PM
Name: Keith Strickland
Website: http://www.keithstric.com
Thank Courtney, but instead of NotesLog, how about OpenLog { Link } ? OpenLog was developed by Julian Robichaux { Link } . This is a great product thats easy as copying a couple of script libraries and including them in your agent/script/whatever, then your developer can log events and errors (errors without coding them I think, I may be wrong) with just a few lines of code (can also log events/errors from Javascript with the newest version). This is an awesome tool that should be used in any Notes Development/Admin shop.
Keith
Date: 11/24/2008 06:32:14 AM
Name: Mark
Website: http://null
Is it possible to add to the recertify user code. For example in my case I need it to look up users who will expire in so many days and recertify them. Thanks
Date: 11/24/2008 09:50:15 AM
Name: Keith Strickland
Website: http://www.keithstric.com
Have a look at @Certificate. Here's the help description:
Extracts information from the Certified Public Key in the Domino Directory.
Syntax
@Certificate( [ dataToRetrieve ] ; Certificate )
Parameters
[ dataToRetrieve ]
Keyword. Must be enclosed in brackets as shown. Use one of the following keywords:
[SUBJECT]
The name of the certified user ID or server ID.
[ISSUER]
The name of the ID used to issue the certificate.
[EXPIRATION]
The date and time that the North American certificate expires.
[INTLEXPIRATION]
The date and time that the International certificate expires.
Certificate
Required. This specifies the name of the field where the Certified Public Key information is stored.
Return value
dataRetrieved
Text for the Subject and Issuer names, and time-date values for the Expiration and IntlExpiration dates.
Usage
@Certificate is useful within a macro or view selection formula for selecting a list of users whose certificates are about to expire; it is used by several Domino Directory tools.
@Certificate only retrieves data; you cannot use it to change certificate information (use the appropriate Administration menus to update certificates). Certified Public Key information is stored only for users and servers with hierarchical IDs;
@Certificate returns a null string for nonhierarchical IDs.
If you use incorrect syntax, @Certificate returns a null string and does not generate an error message.
@Certificate returns a null string (""), instead of the name of the server ID, when used in a Scheduled agent running on the server.
You cannot use this function in Web applications
Hope this helps