27. April 2017 10:39
IF ISCLEAR(OApplication) THEN
CREATE(OApplication,TRUE,TRUE);
IF (NOT OApplication.Logon(TRUE,'','',FALSE,FALSE)) THEN BEGIN
OApplication.Logoff;
EXIT
END;
IF ISCLEAR(OAppointment) THEN
CREATE(OAppointment,TRUE,TRUE);
ErrorNo := 0;
MailGUIDValue := CREATEGUID;
OAppointment.SetUserProperty(GetMailGUIDFieldName,1,FORMAT(MailGUIDValue));
OAppointment.Subject := 'NAV Test Appointment';
OAppointment.Start := TODAY;
OAppointment.EndTime := TODAY;
OAppointment.AllDayEvent := TRUE;
OAppointment.Display := TRUE;
//OAppointment.Save;
OAppointment.Send;
ErrorNo := OAppointment.ErrorStatus;
OApplication.Logoff;
CLEAR(OApplication);
CREATE(OutlookApplication);
NameSpace := OutlookApplication.GetNamespace('MAPI');
NameSpace.Logon;
AppointmentItem := OutlookApplication.CreateItem(1);
AppointmentItem.Start := TODAY;
AppointmentItem."End" := TODAY;
//"AppointmentItem".StartUTC(TODAY);
AppointmentItem.Subject := 'NAV Test Appointment';
AppointmentItem.Body := 'This is a test appointment send from NAV';
AppointmentItem.Duration := 60;
AppointmentItem.ReminderMinutesBeforeStart := 1;
AppointmentItem.ReminderSet := TRUE;
AppointmentItem.RequiredAttendees := 'pka@paeffgen.com';
AppointmentItem.MeetingStatus := 1;
AppointmentItem.Save;
AppointmentItem.Send;
NameSpace.Logoff;
CLEAR(OutlookApplication);