I am having following code which creates the outlook appointment in my calendar but does not send to recipients. I want to send it to recipients.
static void OutlookAppointment(Args _args)
{
COM sysOutlookCollection;
COM receipiants;
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 sysOutlookMAPIFolder;
;
sysOutlook = new COM(#outlook);
sysOutlookNameSpace = sysOutlook.getNamespace(#mapi);
sysOutlookNameSpace.logon();
sysOutlookMAPIFolder =
sysOutlookNameSpace.getDefaultFolder(#OlDefaultFolders_olFolderCalendar);
//sysOutlookNameSpace.getDefaultFolder(#OlDefaultFolders_olFolderOutbox);
collection=sysOutlookMAPIFolder.items();
c =collection.add();
comStartDate.date(today());
comStartDate.time(str2Time( "16:00:00"));
comEndDate.date(today());
comEndDate.time(str2Time( "16:45:00"));
c.location("dotcom");
c.subject("Ax testing");
c.body("Ax testing");
c.start(comStartDate);
c.end(comEndDate);
c.save();
if (c)
{
receipiants = c.Recipients();
receipiants.add("xyz@xyz.com");
receipiants.ResolveAll();
//c.finalize();
// c.assign();
c.display();
// c.sendtoreceipiants();
c.send();
// collection.send();
c.finalize();
info("The action is created in Microsoft Outlook");
}
else
throw error("@SYS31969");
sysOutlookNameSpace.logoff();
}
*This post is locked for comments
Hi Mukesh04 When you Insert Code Give it some Design.
static void OutlookAppointment(Args _args) { COM sysOutlookCollection; COM receipiants; 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 sysOutlookMAPIFolder; ; sysOutlook = new COM(#outlook); sysOutlookNameSpace = sysOutlook.getNamespace(#mapi); sysOutlookNameSpace.logon(); sysOutlookMAPIFolder = sysOutlookNameSpace.getDefaultFolder(#OlDefaultFolders_olFolderCalendar); //sysOutlookNameSpace.getDefaultFolder(#OlDefaultFolders_olFolderOutbox); collection=sysOutlookMAPIFolder.items(); c =collection.add(); comStartDate.date(today()); comStartDate.time(str2Time( "16:00:00")); comEndDate.date(today()); comEndDate.time(str2Time( "16:45:00")); c.location("dotcom"); c.subject("Ax testing"); c.body("Ax testing"); c.start(comStartDate); c.end(comEndDate); c.save(); if (c) { receipiants = c.Recipients(); receipiants.add("xyz@xyz.com"); receipiants.ResolveAll(); //c.finalize(); // c.assign(); c.display(); // c.sendtoreceipiants(); c.send(); // collection.send(); c.finalize(); info("The action is created in Microsoft Outlook"); } else throw error("@SYS31969"); sysOutlookNameSpace.logoff(); }
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156