web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

sending outlook meeting request through x++ code

(0) ShareShare
ReportReport
Posted on by 30

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

I have the same question (0)
  • UmesH@ Profile Picture
    810 on at

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


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans