Share via


Open Outlook appointment from AX

static void OutlookAppointment( Args _args)
{
  COM sysOutlookCollectio n;
  COM collection;
  COMVariant StartDate = new COMVariant() ;
  COMVariant EndDate = 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(systemDateGet( ));
   comStartDate. time(str2Time( "18:00:00"));
   comEndDate.date( today());
   comEndDate.time( str2Time( "18:30:00"));
   c.location("Some location");
   c.subject("Some subject");
   c.body(Some contents");
   c.start(comStartDat e);
   c.end(comEndDate) ;
   c.save();
   if (c)
   {
     c.display();
     info("This has been created in Microsoft Outlook");
   }
   else
    throw error("Error");
    sysOutlookNameSpace .logoff() ;
}

Comments

  • Anonymous
    June 09, 2010
    Really heplful and this is what I am lookin for.