• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2995
  • Last Modified:

LotusScript - send Calendar meeting reschedule notice

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

  • 3
  • 2
1 Solution
Sjef BosmanGroupware ConsultantCommented:
Have just 2 cents to offer: use the iCalendar format, see http://en.wikipedia.org/wiki/ICalendar and http://www-10.lotus.com/ldd/dominowiki.nsf/dx/ical-comp-domino-exchange . Whether and how Notes processes reschedule requests arriving in this format I don't know.
cohalexAuthor Commented:
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.
Sjef BosmanGroupware ConsultantCommented:
I hope not, since your colleague developed this more than umpteen years ago... ;-) And Notes has progressed, so...

Fingers crossed!
cohalexAuthor Commented:
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.
cohalexAuthor Commented:
workaround suggested - works, but with a compromise in the functionality
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now