Using Outlook Automation Appointment NAV 5

Hi,

I’ve been trying to implement some NAV functions to work with Outlook. Microsoft help is not definitely enough, if you have a look to help contents, you soon realize that all programming help is oriented to VBA and watching the C/AL Symbol Menu, many properties of the Automation objects doesn’t work or exist (I will write a few examples at the end). All that, made that me, an unexperienced NAV programmer (only a pair of months), got quickly desperated… anyway, at last I could write a few lines that create an appointment in Outlook and I want to share them with Dynamic’s people.

Automation VARS
OLAppl Automation ‘Microsoft Outlook 11.0 Object Library’.Application
OLNamespace Automation ‘Microsoft Outlook 11.0 Object Library’.NameSpace
OLAppointmentItem Automation ‘Microsoft Outlook 11.0 Object Library’.AppointmentItem

FUNCTION
crearCitaOutlook(fechaIni : Date;minutosDuracion : Duration;titulo : Text[50];mensaje : Text[100])
CLEAR(OLAppl);
CREATE(OLAppl);
OLNamespace := OLAppl.GetNamespace(‘MAPI’);
OLNamespace.Logon(’’,’’,TRUE,FALSE);
OLAppointmentItem := OLAppl.CreateItem(1);
OLAppointmentItem.Start(fechaIni);
OLAppointmentItem.Duration(minutosDuracion);
OLAppointmentItem.Subject(titulo);
OLAppointmentItem.Body(mensaje);
OLAppointmentItem.ReminderSet := FALSE; //creates an alarm
OLAppointmentItem.Save;
OLNamespace.Logoff;

NOTES

  • OLAppointmentItem.End(endDate) doesn’t work, it displays it doesn’t exist the var or record End for that object
  • There is no properties to fix the time of start and end of the appointment and I think this is really important
  • I couldn’t yet test de Logon method to create the appointment with other Outlook user session

If someone can complete this topic, ask or comment anything, I would be loved.
Hope it helps [:D]