Solved

LotusScript - send Calendar meeting reschedule notice

Posted on 2012-03-22
5
2,806 Views
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
		Else
		'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
	Invitation.Send(False)
	If taskdoc.ApptUNID(0) = "" Then
		TaskDoc.ApptUNID = invitation.UniversalID
		Call TaskDoc.Save(True, False)
	End If
End Sub

Open in new window

0
Comment
Question by:cohalex
  • 3
  • 2
5 Comments
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
ID: 37756046
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.
0
 
LVL 4

Author Comment

by:cohalex
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.
0
 
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!
0
 
LVL 4

Author Comment

by:cohalex
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.
0
 
LVL 4

Author Closing Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now