Subject: It’s possible (maybe)
All of this was from the 4/5 forum for LS and somewhere on the web (google is freaking awesome!). I can’t take credit for any of this.
Side note: if you need to ‘do stuff in MS products’, your best bet it the MS forums.
I don’t know anything about the 365 infrastructure; the code below is javaScript that is able to update the current OS user’s Outlook calendar.
function AddCalendarAppointment(appointmentSubject,appointmentBody,travelLocation,startDT,endDT) {
outlookApp = new ActiveXObject(“Outlook.Application”);
nameSpace = outlookApp.getNameSpace(“MAPI”);
// Get a handle of the Calendar folder
apptFolder = nameSpace.getDefaultFolder(9);
// Create a new Appointment item and fill it in
apptItem = apptFolder.Items.add(“IPM.Appointment”);
apptItem.Subject = appointmentSubject;
apptItem.Body = appointmentBody;
apptItem.Location = travelLocation;
apptItem.Start = startDT;
apptItem.End = endDT;
apptItem.ReminderOverrideDefault = true;
apptItem.ReminderSet = true;
apptItem.ReminderMinutesBeforeStart = 15
apptItem.Save();
alert(‘The event is now on your calendar, and you are signed up for the class’);
document.forms[0].submit();
// reminder setting causes the code to fail
// apptItem.ReminderOverrideDefault = True
// apptItem.ReminderSet = True;
//apptItem.ReminderMinutesBeforeStart = 15
//apptItem.BusyStatus = Outlook.OlBusyStatus.olOutOfOffice;
//apptItem.AllDayEvent = true;
// Show the new contact
//apptItem.Display(false); // true = modal
}
Here it is in LS:
Sub Initialize
Print "start"
Dim session As New NotesSession
’ Get Current Document
Set doc = session.documentcontext
’ Get Document Fields
Startdt = Doc.Start(0)
Enddt = Doc.end(0)
Body = Doc.desc(0)
Subject = Doc.appSubject(0)
’ Set Outlook object
’ Code dies here
Set appOutl = CreateObject("Outlook.Application")
Set myNameSpace = appOutl.GetNameSpace("MAPI")
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(1)
’ Set Appointment fields
With myItem
.Start = Startdt
.End = Enddt
.Body = Body
.Subject = Subject
.save
End With
’ Close object references.
Set appOutl = Nothing
Set myItem = Nothing
End Sub