Creating outlook appointments through Axapta
static void OutlookAppointment( Args _args)
{
COM sysOutlookCollection;
COM collection;
COM c,to;
COMVariant comStartDate = new COMVariant() ;
COMVariant comEndDate = new COMVariant() ;
#SysOutLookCOMDEF
#define.mapi("MAPI")
#define.outlook("Outlook.Application")
COM sysOutlook;
COM sysOutlookNameSpace ;
COM sysOutlookMAPIFolder;
;
sysOutlook = new COM(#outlook) ;
sysOutlookNameSpace = sysOutlook.getNamespace(#mapi) ;
sysOutlookNameSpace .logon();
sysOutlookMAPIFolder = sysOutlookNameSpace .getDefaultFolder(#OlDefaultFolders_olFolderCalendar );//Find the Folder in which meeting is saved
collection = sysOutlookMAPIFolder.items() ;
c = collection.add( );
c.MeetingStatus(1); // Set type to meeting
to = c.Recipients();
to.add('sukrut.parab@ignify.com');
comStartDate. date(today( ));
comStartDate. time(str2Time( "16:00:00"));
comEndDate.date( today());
comEndDate.time( str2Time( "16:45:00"));
c.location("Ignify Software Pvt Ltd,4th Floor ,Board Room ");
c.subject("Celluphone CRM implementation");
c.body("Activity 0001");
c.start(comStartDate);
c.end(comEndDate) ;
c.save();
if (c)
{
c.display();
info("The action is created in Microsoft Outlook");
}
else
throw error("Error");
sysOutlookNameSpace .logoff() ;
}
Nice post! Can it be done by creating a COM Class using the Wrapper wizard and calling the methods of that class?
ReplyDelete