LotusScript - send Calendar meeting reschedule notice

Posted on 2012-03-22
Last Modified: 2013-12-18
I am sending meeting invitations programatically through LotusScript, from a specific application.
The goal is to send a Calendar invitation to a user by mail.
The user should be able to click action - Add to Calendar, and optimally not have any other options - like Accept / Decline / Propose new time / Delegate, etc...
Although there is a sender, the sender does not need any Calendar entry for himself - this is all about dispatching tasks to others.

I managed to do all of the above, but need one more feature which will make this whole thing useful: when the start or end date and time change, I want to be able to send a reschedule notice to the invitees.
They should be able to open it and - either have it processed automatically into the original Calendar entry, or, have an action button to Add to Calendar.

This is of-course built-in into the Notes C&S design and should be no big deal.
However, for some unknown reason, when I open the reschedule notice - it says that the notice has already been applied to the meeting - and no other option is available.
When you go to the original meeting - there is no update.

I have already tried creating the Notice docs in the sender's mail file and using compute with form, as well as looking at documents created manually and recreating almost every field that I found on the manual docs in the script - which is the version bellow.
I am computing both ApptUNID and $REF fields correctly (they are set to the value of the first Notice's UNID - it only matters that there is the same value everywhere).

To conclude, I need a way to send Calendar entries by mail, plus a way to send updates to those entries.
I am sure that someone else thought about this as well in the history of Notes.
Does anyone have any solution ?

Sub SendNotes(taskdoc As NotesDocument)
	'Send a Calendar Appointment invitiation using Notes style Calendaring and Scheduling built-in the mail template
	Dim invitation As notesdocument
	Dim item As NotesItem
	Dim startdttm As NotesDateTime
	Dim enddttm As NotesDateTime
	Dim rtitem As NotesRichTextItem
	Dim prompt As String
	Dim language As String
	Dim tasktype As String
	Dim tmpItem As NotesItem

	'Compute SendTo and CopyTo items
	Dim SendTo$, CopyTo$

	Set invitation = New NotesDocument( taskdoc.ParentDatabase )
	With invitation
		.ReplaceItemValue "$altPrincipal", taskdoc.Task_assign
		.ReplaceItemValue "$CSVersion", "2"
		.ReplaceItemValue "$EncryptionStatus", "0"
		.ReplaceItemValue "$FromPreferredLanguage", language
		.ReplaceItemValue "$PublicAccess", "1"
		.ReplaceItemValue "$SignatureStatus", "0"
		.ReplaceItemValue "$SMTPKeepNotesItems", "1"
		.ReplaceItemValue "AppointmentType", "3"		
		.ReplaceItemValue "Broadcast", "1"
		.ReplaceItemValue "Chair", TaskDoc.Task_assign
		.ReplaceItemValue "Encrypt", "0"
		.ReplaceItemValue "Form", "Notice"
		Set tmpItem = New NotesItem(invitation, "From", taskdoc.Task_assign, NAMES)
		tmpItem.IsSummary = True		
		.ReplaceItemValue "PreventCounter", "1"
		.ReplaceItemValue "PreventDelegate", "1"
		.ReplaceItemValue "Principal", TaskDoc.Task_assign
		Set tmpItem = New NotesItem(invitation, "SendTo", Split(SendTo$, ","), NAMES)
		tmpItem.IsSummary = True
		Set tmpItem = New NotesItem(invitation, "CopyTo", Split(CopyTo$, ","), NAMES)
		tmpItem.IsSummary = True
		.ReplaceItemValue "SequenceNum", 1
		Set tmpItem = New NotesItem(invitation, "StorageRequiredNames", "1", NAMES)
		tmpItem.IsSummary = True
		.ReplaceItemValue "UpdateSeq", 1
		If taskdoc.ApptUNID(0) = "" Then
		'Send first time invitation
			.ReplaceItemValue "$CSWISL", Evaluate({@Explode("$S:1;$L:1;$B:1;$R:1;$E:1;$W:1;$O:1;$M:1;RequiredAttendees:1;INetRequiredNames:1;AltRequiredNames:1;StorageRequiredNames:1;OptionalAttendees:1;INetOptionalNames:1;AltOptionalNames:1;StorageOptionalNames:1"; ";")})
			.ReplaceItemValue "$HFFlags", "1"
			.ReplaceItemValue "$IconSwitcher", "Meeting"
			.ReplaceItemValue "$NameLanguageTags", language
			.ReplaceItemValue "$StorageCc", ""
			.ReplaceItemValue "$StorageTo", "1"
			.ReplaceItemValue "$TableSwitcher", "FindAvailTimes"
			.ReplaceItemValue "$WatchedItems", Evaluate({@Explode("$S;$L;$B;$R;$E;$W;$O;$M;RequiredAttendees;INetRequiredNames;AltRequiredNames;StorageRequiredNames;OptionalAttendees;INetOptionalNames;AltOptionalNames;StorageOptionalNames"; ";")})
			.ReplaceItemValue "ApptUNID", .UniversalID
			.ReplaceItemValue "FromCategories", "AIO - " + tasktype
			.ReplaceItemValue "IsBroadcast", "0"
			.ReplaceItemValue "Logo", "StdNotesLtr25"
			.ReplaceItemValue "NoticeType", "I"
			.ReplaceItemValue "OrgTable", "C0"
			.ReplaceItemValue "SchedulerSwitcher", "1"
			.ReplaceItemValue "Sign", ""
			.ReplaceItemValue "Subject", ShF_getPhrase("S$Shared", "Task notice") + " - " + taskdoc.Task_name(0)
			.ReplaceItemValue "_ViewIcon", 133
		'Send notice update
			.ReplaceItemValue "$CSFlags", "w"
			.ReplaceItemValue "$CSWISL", Evaluate({@Explode("$L:1;$R:1;$E:1;$W:1;$O:1;$M:1;RequiredAttendees:1;INetRequiredNames:1;AltRequiredNames:1;StorageRequiredNames:1;OptionalAttendees:1;INetOptionalNames:1;AltOptionalNames:1;StorageOptionalNames:1;$S:2;$B:2"; ";")})
			Call .MakeResponse(taskdoc) '(invitation.ParentDatabase.GetProfileDocument("(CalendarProfile)"))
			Set tmpItem = .getfirstitem("$REF")
			Forall v In tmpItem.Values
				v = taskdoc.ApptUNID(0)
			End Forall
			.ReplaceItemValue "$REFOPTIONS", "1"
			.ReplaceItemValue "ApptUNID", taskdoc.ApptUNID
			.ReplaceItemValue "NoticeType", "U"			
			Set tmpItem = New NotesItem(invitation, "RequiredAttendees", Split(SendTo$, ","), NAMES)
			tmpItem.IsSummary = True
			.ReplaceItemValue "Subject", ShF_getPhrase("S$Shared", "Task update") + " - " + taskdoc.Task_name(0)
			.ReplaceItemValue "_ViewIcon", 33
		End If
	End With
	'Set the Body RT field
	Set rtitem = New NotesRichTextItem(invitation, "Body" )
	With rtItem
	End With
	'Compute the Date and time fields
	Set startdttm = New NotesDateTime(Trim(taskdoc.Task_start(0) & " " & taskdoc.Task_Start_Time(0)))
	Set enddttm = New NotesDateTime(Trim(taskdoc.Task_term(0) & " " & taskdoc.Task_term_Time(0)))
	Set invitation.StartDateTime = startdttm '.LocalTime
	invitation.StartDate = taskdoc.Task_start 'startdttm '.LocalTime
	invitation.StartTime = taskdoc.Task_Start_Time 'startdttm '.LocalTime
	invitation.StartTimeZone = Evaluate({@GetCurrentTimeZone})
	Set invitation.EndDateTime = enddttm '.LocalTime
	invitation.EndDate = taskdoc.Task_term 'enddttm '.LocalTime
	invitation.EndTime = taskdoc.Task_term_Time 'enddttm '.LocalTime
	invitation.EndTimeZone = Evaluate({@GetCurrentTimeZone})
	'Send the invitation and save ApptUNID on the task doc
	If taskdoc.ApptUNID(0) = "" Then
		TaskDoc.ApptUNID = invitation.UniversalID
		Call TaskDoc.Save(True, False)
	End If
End Sub

Open in new window

Question by:cohalex
  • 3
  • 2
LVL 46

Accepted Solution

Sjef Bosman earned 500 total points
ID: 37756046
Have just 2 cents to offer: use the iCalendar format, see and . Whether and how Notes processes reschedule requests arriving in this format I don't know.

Author Comment

ID: 37756233
We already have a completely different MIME iCal version of this function, designed to send invitations for non-Notes mail users. It was developed a while back, and for some forgotten reason, the updates weren't working in that case also - it was tested with Mac's Entourage mail client.
We didnt test it on Notes, as we figured we could built a native Notes function, to have more control, for the Notes users.
As I don't have other options now, I'll give it a try, but I fear that I will hit the same wall that my colleague who developed the iCal did as well.
LVL 46

Expert Comment

by:Sjef Bosman
ID: 37756405
I hope not, since your colleague developed this more than umpteen years ago... ;-) And Notes has progressed, so...

Fingers crossed!

Author Comment

ID: 37845776
I did manage to make it work with iCal, but there are a couple of disadvantages:
- I am embedding a notes:// link in the HTML body, which doesn't show the alias, just the raw url
- the whole iCal is added by Domino as an attachment in the Body field; users tend to open it, and wonder what to do with it; I guess adding another comment about in the Description would help..

One advantage of this approach is that I only have to maintain one set of functions for all mail clients.

Author Closing Comment

ID: 37845777
workaround suggested - works, but with a compromise in the functionality

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is an old article, please see an updated version of this article, located here:
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question