Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Sunday, September 22, 2013

Send task msg from current outlook in Dynamic AX


Hi,

static void AppointmentFrom
Outlook(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_olFolderTasks);
collection         = sysOutlookMAPIFolder.items();
 c = collection.add();
 comStartDate.date(today());
   comStartDate.time(str2Time( "12:00:00"));
   comEndDate.date(today());
   comEndDate.time(str2Time( "12:15:00"));
   c.subject("This is the subject");
   c.body("Body of that msg");
   c.save();
   if (c)
   {
     receipiants = c.Recipients();
     receipiants.add("mdalfasith@gmail.com");
     receipiants.ResolveAll();
     c.assign();
     //c.display();
     c.send();
     info("Success msg in AX");
   }
   else
   throw error("@SYS31969");
   sysOutlookNameSpace.logoff();
 } 

2 comments:

  1. Can you give an example scenario from end user perspective, how to use the subject code and get benefit of it.

    ReplyDelete
    Replies
    1. Here I'm using COM (Common Object model) "C" tool as collections then adding the element in to the collection as C.subject(), C.Body() later am retrieving
      so hope you got my explanation.

      Delete

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...