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() ;

}

Comments

  1. Nice post! Can it be done by creating a COM Class using the Wrapper wizard and calling the methods of that class?

    ReplyDelete

Post a Comment

Popular posts from this blog

Running runnable class through URL in Dynamics 365 for Operations

D365FO Use of FileUpload control to Read CSV file

D365FO Send Report as email attachment