Notes Cannot Do This? Client Defined Delivery Schedule

I found this idea on IdeaJam today. There have been several questions regarding scheduled mails in almost all Lotus Notes related forums in the past years and as far as I recall, Breaking Par has had a solution for this.

Although I do not see any business case for this feature, I like the idea. And yes, Notes cannot do this out of the box. But let’s see, if we can find a solution. As I commented, you can use Trigger Happy to achieve the goal. The solution only needs minor changes on the mail template.
I use Notes and Domino 8.0.1 but the agent code and the modification might work on every other Notes version. I assume that you already have Trigger Happy installed on your server.

Create two new fields in the DelOptions subform. DeliveryDate and DeliveryTime.

and save the subform.

Create an new agent in the triggerhappy.nsf and copy the following code into the agent:

'Agent ScheduledMails

Option Public
Option Explicit

'++ Declarations

Const SCHEDULED_MAILS = {@IsAvailable("DeliveryDate") & RoutingState="HOLD"}

Sub Initialize
	On Error Goto processError
	Dim session As New NotesSession
	Dim doc As NotesDocument
	Dim item As NotesItem
	Dim Scheduled As String
	Dim dtNow As New NotesDateTime(Now)
	Dim mailbox As New NotesDatabase ( "Serv01/singultus","" )
	Dim col As NotesDocumentCollection
	Dim i As Integer

	'** make sure we don't mess up the rich text fields stored as MIME
	session.ConvertMime = False
	Set doc = session.DocumentContext

	'** check new mails
	If doc.HasItem("DeliveryDate") And (Not doc.HasItem("RoutingState" )) Then
		If Trim(doc.DeliveryDate(0)) <> "" Then
			Scheduled = _
			"Message delivery scheduled: " _
			& Cstr(doc.DeliveryDate(0)) & " " & Cstr(doc.DeliveryTime(0))
			Print scheduled
			doc.RoutingState = "HOLD"
			doc.FailureReason = Scheduled
		End If
	End If

	'** scheduled mails to deliver ?
	If mailbox.IsOpen() Then
		Set col = mailbox.Search(SCHEDULED_MAILS,Nothing,0)
		Set doc = col.GetFirstDocument
		While ( Not doc Is Nothing )
			Dim dtSched As New NotesDateTime _
			( Cstr(doc.DeliveryDate(0)) & " " & Cstr(doc.DeliveryTime(0)) )
			If dtSched.localtime <= dtNow.LocalTime Then
				Call doc.RemoveItem ("RoutingState")
				Call doc.RemoveItem ("FailureReason")
				Call doc.Save(False,False)
			End If
			Set doc = col.GetNextDocument(doc)

	End If

	session.ConvertMime = True
	Exit Sub

	'** use your favorite error logging routine here

	Exit Sub

End Sub

Create a trigger in the configuration database.

and save it. Every time, a new mail arrives in the, the agent is invoked. It checks the new mail, if it has a DeliveryDate item and if the item contains a value.
If so, the RoutingState is set to HOLD. The router will stop to deliver the mail. The second step is to check if the the delivery date and time is reached. If so, the agent removes the RoutingState field from the document and the router will process the document and deliver it.

The FailureReason column contains a hint that the mail is scheduled.

Delete Group Members Using The Administration Process

Recently, our company is evaluating a 3rd party mail archiving solution. This solution stores mails together with a snapshot of the ACL. (non-Notes) This is a clever solution, because you have Notes security on these archived documents ( client and web ). I do not want to dig too deep into this product, but we found out during evaluation that the â??ACL snapshotâ? feature will get you into trouble when you delegate your mail file.

Imagine a scenario, where User A delegates his mail file to user B. User B has author access (this necessarily includes reader access. ï? ) When the mail archive process starts, it will save the ACL together with the document. If user B retrieves a document from the archive, thereâ??ll be no problem at all.

Now user B quits the company and he /she is replaced by user C. User A modifies the delegation profile according to the new situation.

But what happens, when user C wants to access documents that have been archived, before he / she had access to the mail file?

To make a long story short, this will not work â?¦

To solve the issue, we decided to put a group into each mail file ACL which has the following format: #ARC-FirstNameLastName-READER.
As the name implies, the access level for this group is READER.

When we now send a mail document to the archive, this group is archived as well. (ACL)

Now we can put user C into this group and immediately this user has access to all archived mails of user A.
Keep in mind that regardless of which access level is given to a user by delegation, he needs at least reader access to access documents from within the archive.
Manually adding members to a group or deleting them is not a good idea, because YOU would have to do the work �.

One of the proposals from the vendor of the mail archiving system was to modify the delegation process in Lotus Notes. Not a good idea at all, because you would have to write a completely new CalendarProfile to achive the goal.

The smallest solution is to have the above mentioned group in the ACL (and names.nsf ) and add code to the CalendarProfile to add / remove members to / from the group. This would keep the code provided by IBM intact. In addition to that you can update to a higher version of Notes and Domino and easily add your modifications to the new template.

The basic algorithm is to add all mail delegates to the group and remove a name from this group when the mail file owner revokes access to his database.

HINT: This article is not ment to be a solution which can be copied and pasted. You will not find any source code here. I will only post a few code snippets.

AdminP is a server task for automating administrative tasks in the background on a schedule. The Domino administration process (AdminP) is a server-side mechanism for automating administrative tasks in the background on a specified schedule. Domino’s AdminP supports everything from user renames to file replications.

Starting with version 6 of Lotus Notes and Domino, you can use the NotesAdministrationProcess class to create AdminP request programmatically with Lotus Script.

One of the methods of the NotesAdministrationProcess class is â??AddGroupMembersâ?.
This method adds members (passed as a parameter in the method call) to an existing group or creates the group first when it does not exist and adds the members to the newly created group.

This is a great feature if you want to enable some users in your organization to maintain groups in the names.nsf without giving them any author or editor rights. Exactly what we need.

But, when doing so, how can they delete users from existing groups using AdminP ? You do not find any method like â??RemoveGroupMembersâ? in the NotesAdministrationProcess class.
Since IBM does not provide us with such a function, I had to create it on my own.

Admin4.nsf - view

Bob Balfe of IBM published an article back in 2003 on developerworks ( LINK )

This is a great starting point to write your own AdminP request handlers using the Notes C API.
As described in the article, I created a new form in the admin4.nsf to contain all the fields needed for the new Administration Request.

adminplus request

I saved the compiled nadminplus.exe to the Domino executable directory and started it typing load nadminplus at the server console.

server console with adminplus

You can now create new RemoveGroupMembers request directly in the admin4.nsf or use the following code to create the requests programmatically with Lotus Script.

'/* Put the following code into the declaration section of an action */
'/* or create a new script library to contain the code */
Const DB_ADMIN4 = "admin4.nsf"
Const FLD_FORM = "CustomRequest"
Const FLD_PROXYACTION = "5005" ' RemoveGroupMembers | 5001

Class NotesAdministrationProcessPlus

	Private szServer As String

	Public Sub new (szServerName As String)
		Dim s As New NotesSession
		Dim nn As NotesName
		Set nn = s.CreateName (szServerName)
		szServer = nn.Canonical
	End Sub

	Public Function  RemoveGroupMembers (ListName As String, Members As Variant) As String
		RemoveGroupMembers = ""
		If  (Ubound (members) = 1 And members(0) ="") Or Trim(ListName) = ""  Then
			Exit Function
			Dim s As New NotesSession
			Dim db As New NotesDatabase( szServer, DB_ADMIN4 )
			Dim doc As NotesDocument

			If db.IsOpen Then
				Set doc = db.CreateDocument
				doc.Form = FLD_FORM
				doc.ProxyAction = FLD_PROXYACTION
				doc.ProxyServer = szServer
				doc.ListName = ListName
				doc.Members = Members
				Call doc.ComputeWithForm(False, False)
				Call doc.Sign
				Call doc.Save(False, True)
				RemoveGroupMembers = doc.NoteID

			End If
		End If

	End Function
End Class

To create the request documents, use the following code:

Sub Click(Source As Button)
	Dim noteid As Variant
	Dim members(1) As String
	members(0) = "Hein Bloed/Maus/de"
	' ...

	Dim AdminPP As New NotesAdministrationProcessPlus ("yourserver")
	noteid = AdminPP.RemoveGroupMembers ("yourgroup", members)
	' ...

End Sub

See the code in action:

If you find this function useful and like to try it by yourself, send me an email or leave a comment. I have also posted an idea on Perhaps you can promote the idea if you like it.

Idea Jam for the IBM Lotus Community to launch in November

Idea Jam Idea Jam is a site where users of IBMâ??s Lotus software products can exchange ideas on how to improve Lotus products. Others can help promote and/or demote ideas, as well as, providing feedback through comments. Popular ideas will rise
to the top. The Idea Jam, unlike blogs and discussion forums, allows a single place for the Lotus community to share and promote ideas and suggestions on how to improve IBM Lotus software.

Ideas are grouped into â??idea spacesâ? â?? which currently include IBMâ??s Lotus Connections, Lotus Notes and Domino, Lotus Quickr, Lotus Sametime, Lotus Symphony and Websphere Portal. Additional idea spaces for OpenNTF and Idea Jam itself will also be available.

Idea Jam includes many features that make the site easy and fun to use:

  • Tags â?? All ideas can be â??taggedâ? with one or more tags. Users can then use tag clouds to see which tags are
  • RSS â?? Idea Jam provides RSS feeds for idea spaces, a specific idea, a user or for any given tag.
  • User Profiles â?? Users can view their ideas, their comments, and the ideas they voted on.
  • Views â?? Ideas can be viewed by popularity, recent ideas, most comments, recent comments or others. Each
    view also has an associated RSS feed.
  • Unvoted â?? Users can easily review ideas that they have not voted on.
  • Random â?? Users can be presented with a random idea to promote or demote.

Elguji Ideas and the Idea Jam were developed by Elguji Software in conjunction with Matt White of Fynn Consulting Ltd., London (, and Sean Burgess of Laurel, Maryland ( Elguji Ideas and Idea Jam software were built with IBM Lotus Domino Designer, The MooTools Javascript framework, the Yahoo User Interface Libraries, Genii Softwareâ??s CoexEdit and run on IBM Lotus Domino 8.0.