Share via


Dynamics AX technical posts

Open Outlook appointment from AX

 static void OutlookAppointment( Args _args)
{
  COM sysOutlookCollectio n;
  COM collection;
  COMVariant comStartDate = new COMVariant() ;
  COMVariant comEndDate = new COMVariant() ;
  COM c;
   #SysOutLookCOMDEF
   #define.mapi("MAPI")
   #define.outlook("Outlook.Application")
   COM sysOutlook;
   COM sysOutlookNameSpace ;
   COM sysOutlookMAPIFolde r;
   ;
   sysOutlook = new COM(#outlook) ;
   sysOutlookNameSpace = sysOutlook.getNames pace(#mapi) ;
   sysOutlookNameSpace .logon();
   sysOutlookMAPIFolde r = sysOutlookNameSpace .getDefaultFolde r (#OlDefaultFolders_ olFolderCalendar );
   collection = sysOutlookMAPIFolde r.items() ;
   c = collection.add( );
   comStartDate. date(today( ));
   comStartDate. time(str2Time( "16:00:00"));
   comEndDate.date( today());
   comEndDate.time( str2Time( "16:45:00"));
   c.location("Sonata Software Ltd,conference Room,2nd Floor ,HO");
   c.subject("Meeting regarding Project status");
   c.body('Discuss about latest issues in project");
   c.start(comStartDat e);
   c.end(comEndDate) ;
   c.save();
   if (c)
   {
     c.display();
     info("The action is created in Microsoft Outlook");
   }
   else
    throw error("Error");
    sysOutlookNameSpace .logoff() ;
}