Hi
I am trying to create appointments in folders form Navision using outllok atuomation as follows:
CREATE(oApp);
oNS := oApp.GetNamespace('mapi');
oRecipient := oNS.CreateRecipient(Recipient);
oFolder := oNS.GetSharedDefaultFolder(oRecipient,9); //9 is constant for Outlook.OlDefaultCalendar.olFolderCalendar
oAppt := oFolder.Items.Add(1); //1 is constant for Outlook.OlItemType.olAppointmentItem
oAppt.Subject := Subject;
oAppt.Location := Location;
StartTime := CREATEDATETIME(Start,Time);
oAppt.Start := StartTime;
oAppt.Duration := (Duration/60000);
oAppt.ReminderSet := TRUE;
oAppt.ReminderMinutesBeforeStart := 15;
oAppt.BusyStatus(2); //2 is constant for Outlook.OlBusyStatus.olBusy
oAppt.IsOnlineMeeting := FALSE;
oAppt.Save;
CLEAR(oAppt);
The problem I am having is with the line
oAppt.Start := StartTime;
The microsoft help pages say that the start property takes a datetime and I am passing a datetime but when I compile the code I get a type conversion message saying that the start property is expecting a date only. Has anyone else had this problem?
I spoke to another developer who said that the datetime type is a recent addition to Navision so maybe Navaion doesn't recognise the datetime type required.
Any thoughts would be appriciated.
Debbie
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Start is Date for Navision .... not DateTime... Any conversion does not help... :?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Kine is correct. The start date expects a date not a datetime so conversion does not seem to help.
I have tried to use the date time conversion ocx just to test this theory but I can't get it to work properly.
Where "Starting date" and "Starting time" and "Ending date" and "Ending time" are Date and Time variables with start and end. If Start time is 0T then event is marked as AllDay event.
8)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
DATI2VARIANT takes a C/AL Date and a C/AL Time and returns a Variant of sub-type VT_DATE -- just what oAppt.Start wants.
I'm pretty sure it works -- the following line is taken from Codeunit 5073 - ToDo Handler:
I didn't notice it before... Thanks!!! :idea:
Debbie140:
What i wrote is for Navision Financials, without VARIANT data type... :oops:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Have you tried to use OLWrapper.DLL (from standart Navision installation) - it is the Outlook Integration component - it wraps Outlook folders, items, events etc. I think it is safer to work with Outlook through this component - it returns error codes and descriptions in case of errors. If you call Outlook objects directly - the program just crushes when error occurs. You can take a look on Codeunits 5072 and 5073 for C/AL examples.
Dmitry
AppointmentItem.Start := DATI2VARIANT(Todo.Date, Todo."Start Time");
but when the invite is created in outlook the time is ignored and all invites are created at 12:00 AM