%remSolution:
How to Send Meeting Invite through Lotus Script:
How to Re-Schedule Meeting Invite through Lotus Script: (Will be covered in next topic)
Compatibility:Release 8.5.2. You can try on other versions too
Steps to send the first meeting invite:
-
Create a Meeting Document in the sender’s mail-box or a mail in database, say, MeetingDoc
-
Create a document to be sent to the recipients. We will call it as an OutBoxDoc
Part 2 : Sending Re-Schedule available @
%end rem
'Here is the code/agent:
'Declaration must be in Global
Dim session As NotesSession
Dim MailDB As NotesDatabase
Dim OutBoxDoc As NotesDocument
Dim MeetingDoc As NotesDocument
Dim StartDTObject As NotesDateTime
Dim EndDTObject As NotesDateTime
Dim StartDate$,StartTime$,EndDate$,EndTime$,StartDateTime$,EndDateTime$
Dim UName$,Topic$,TimeZone$,Location$
Dim Recipients
'///////////////////////////
’
Sub Initialize
Set session=New NotesSession
Call SetParameters
Call CreateMeetingDoc
Call CreateOutBoxDoc
End Sub
'///////////////////////////////
Sub SetParameters
StartDate$="18-Apr-2014"
StartTime$="09:00"
EndDate$="18-Apr-2014"
EndTime$="10:00"
StartDateTime$=StartDate$+" "+StartTime$
EndDateTime$=EndDate$+" "+EndTime$
Set StartDTObject = New NotesDateTime(StartDateTime$)
Set EndDTObject = New NotesDateTime(EndDateTime$)
Topic$="Domino Solutions"
UName$="SENDER NAME" ' Notes Name or any name whose mail box is on the server
'MailDatabasePath is where you want to create a meeting document
Set MailDB=session.GetDatabase("ServerName","MailDatabasePath") ' associated with UName$
' comma separated names
Recipients=Split("Lotus Notes Canonical or abbreviated format, xyz@abc.com, somename@gmail.com",",")
Location$="New York"
End Sub
'/////////////////////////////////////
Sub CreateMeetingDoc
Set MeetingDoc=MailDB.CreateDocument
MeetingDoc.Form="Appointment" 'IMPORTANT
MeetingDoc.Subject=Topic$
Call MeetingDoc.ReplaceItemValue("StartDateTime",StartDTObject)
Call MeetingDoc.ReplaceItemValue("CalendarDateTime",StartDTObject) 'IMPORTANT
Set StartDTObject= New NotesDateTime(StartDateTime$)
Call StartDTObject.SetAnyTime 'It will set only Date (not time)
Call MeetingDoc.ReplaceItemValue("StartDate",StartDTObject)
Set StartDTObject= New NotesDateTime(StartDateTime$)
Call StartDTObject.SetAnyDate 'It will set only Time (not date
Call MeetingDoc.ReplaceItemValue("StartTime",StartDTObject)
Set EndDTObject= New NotesDateTime(EndDateTime$)
Call MeetingDoc.ReplaceItemValue("EndDateTime",EndDTObject)
Call EndDTObject.SetAnyTime 'It will set only Date (not time)
Call MeetingDoc.ReplaceItemValue("EndDate",EndDTObject)
Set EndDTObject= New NotesDateTime(EndDateTime$)
Call EndDTObject.SetAnyDate 'It will set only Time (not date)
Call MeetingDoc.ReplaceItemValue("EndTime",EndDTObject)
Call MeetingDoc.ReplaceItemValue("$CSVersion","2") 'IMPORTANT
Set EndDTObject= New NotesDateTime(EndDateTime$)
Call MeetingDoc.ReplaceItemValue("$NoPurge",EndDTObject)'Common
Call MeetingDoc.Replaceitemvalue("$PublicAccess","1") 'IMPORTANT
Call MeetingDoc.Replaceitemvalue("AppointmentType","3") 'IMPORTANT
Call MeetingDoc.Replaceitemvalue("ApptUNID",MeetingDoc.UniversalID) 'IMPORTANT
Call MeetingDoc.Replaceitemvalue("Chair",UName$)
Call MeetingDoc.Replaceitemvalue("From",UName$)
Call MeetingDoc.Replaceitemvalue("Location",Location$)
Call MeetingDoc.Replaceitemvalue("MailOptions","0")
Call MeetingDoc.Replaceitemvalue("OriginalModTime",Now)
Call MeetingDoc.Replaceitemvalue("Principal",UName$)
Call MeetingDoc.Replaceitemvalue("Recipients",Recipients)
Call MeetingDoc.Replaceitemvalue("RequiredAttendees",Recipients)
Call MeetingDoc.ReplaceItemValue("SequenceNum",1) 'IMPORTANT
Call MeetingDoc.ReplaceItemValue("UpdateSeq",1)
Call MeetingDoc.Replaceitemvalue("_ViewIcon",133)
Call MeetingDoc.Save(1,0)
End Sub
'///////////////////////////////
Sub CreateOutBoxDoc
Set OutBoxDoc=MailDB.CreateDocument
OutBoxDoc.Form="Notice" 'IMPORTANT
OutBoxDoc.Subject="Invitation: "+Topic$+" "+"( "+StartDateTime$+" in " +Location$+")"
OutBoxDoc.SendTo=Recipients
OutBoxDoc.Topic=Topic$
Set StartDTObject = New NotesDateTime(StartDateTime$)
Set EndDTObject = New NotesDateTime(EndDateTime$)
Call OutBoxDoc.ReplaceItemValue("StartDateTime",StartDTObject)
Set StartDTObject= New NotesDateTime(StartDateTime$)
Call StartDTObject.SetAnyTime 'It will set only Date (not time)
Call OutBoxDoc.ReplaceItemValue("StartDate",StartDTObject)
Set StartDTObject= New NotesDateTime(StartDateTime$)
Call StartDTObject.SetAnyDate 'It will set only Time (not date
Call OutBoxDoc.ReplaceItemValue("StartTime",StartDTObject)
Set EndDTObject= New NotesDateTime(EndDateTime$)
Call OutBoxDoc.ReplaceItemValue("EndDateTime",EndDTObject)
Call EndDTObject.SetAnyTime 'It will set only Date (not time)
Call OutBoxDoc.ReplaceItemValue("EndDate",EndDTObject)
Set EndDTObject= New NotesDateTime(EndDateTime$)
Call EndDTObject.SetAnyDate 'It will set only Time (not date)
Call OutBoxDoc.ReplaceItemValue("EndTime",EndDTObject)
Call OutBoxDoc.ReplaceItemValue("$CSVersion","2") 'IMPORTANT
Set EndDTObject= New NotesDateTime(EndDateTime$)
Call OutBoxDoc.ReplaceItemValue("$NoPurge",EndDTObject)
Call OutBoxDoc.Replaceitemvalue("$PublicAccess","1") 'IMPORTANT
Call OutBoxDoc.Replaceitemvalue("AppointmentType","3") 'IMPORTANT
Call OutBoxDoc.Replaceitemvalue("ApptUNID",MeetingDoc.UniversalID) 'IMPORTANT
Call OutBoxDoc.Replaceitemvalue("Chair",UName$)
Call OutBoxDoc.Replaceitemvalue("From",UName$)
Call OutBoxDoc.Replaceitemvalue("Location",Location$)
Call OutBoxDoc.Replaceitemvalue("NoticeType","I") 'IMPORTANT
Call OutBoxDoc.Replaceitemvalue("OriginalModTime",Now)'Modification Time
Call OutBoxDoc.Replaceitemvalue("Principal",UName$)
Call OutBoxDoc.Replaceitemvalue("Recipients",Recipients)
Call OutBoxDoc.Replaceitemvalue("RequiredAttendees",Recipients)
Call OutBoxDoc.ReplaceItemValue("SendTo",Recipients)
Call OutBoxDoc.Replaceitemvalue("SequenceNum",1) 'IMPORTANT
Call OutBoxDoc.ReplaceItemValue("UpdateSeq",1)
Call OutBoxDoc.ReplaceItemValue("WebDateTimeInit","1")
Call OutBoxDoc.Replaceitemvalue("_ViewIcon",133)
OutBoxDoc.UniversalID=MeetingDoc.UniversalID 'VERY VERY IMPORTANT
Call OutBoxDoc.Send(0)
End Sub