|
15.12.2010, 17:11 | #1 |
Участник
|
daxdilip: [Updated] Code to read email using EWS (Exchange Web Services)
Источник: http://daxdilip.blogspot.com/2010/12...using-ews.html
============== Thanks for all my blog readers as I got an overwhelming response for this post asking me for the code to connect using EWS and read email from Exchange Server For starters, this is the Part 1 which gives a theoretical view of using EWS to read email without having Outlook Client on your AOS http://daxdilip.blogspot.com/2010/12...-download.html This is all the code which does the job: a. Declaration b. Logic for reading the email for a particular email address and subject and downloading the attachment As you have seen the code above is very self-explanatory as it calls the Exchange Service proxy to do a FindItems for the mailbox folder (Inbox) and for a particular subject. The next part in code is where it loops through the item collection and if it finds an attachment for the message item, it will download the attachment to the path supplied. Limitations: a. I tried to directly invoke the code from AX by adding the Exchange Service Assembly to the Resources node in AOT, but I'm unable to marshall the complex types and generics between X++ and .Net, Also the class ContainsSubstring is an abstract implementation in .Net which I'm unable to get a handle via X++, so I had to write a custom .Net wrapper and then call this from X++. b. The X++ code which invokes my custom .Net assembly works fine without any issues if it's run via a job or class or menu item but as soon as I put it in a batch it doesn't work. It just fails without any error log. If anyone has any ideas or have invoked custom .Net assemblies via a batch, can you throw some light Источник: http://daxdilip.blogspot.com/2010/12...using-ews.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|