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 to invoke and iterate List as Contract methods in AX 2012/ D365

Hi, Public void performContractIterate(ClassContainsListAsContract    _ListCarryClass) { List contractFieldList = new List(Types::Class); ...