How to get the whole body of a mail message from Office 2013 Javascript API RRS feed

  • Question

  • I am working on a prototype Outlook 2013 mail application that would allow a user to attach the contents of an email to an external system. In this case the external system is a SAAS task tracking web application, but could just as easily be any external web app like an hosted CRM app, ERP system, etc.

    The desired workflow would be:

      • User opens an email in Outlook 2013 (via the web or desktop app) and wants to "attach" the email to an external system.
      • User clicks on our app's link from the list of installed mail apps across the top of the message. 
      • Our Outlook mail app opens and lets the user search and choose a record to "attach" their email to. 
      • Javascript in our Outlook app get's the message information (sender, date, recipients, subject, and body) via the Javascript API (http://msdn.microsoft.com/en-us/library/office/apps/fp161175(v=office.15)).
      • Our Outlook app then makes an XMLHTTP request to our hosted web application to append the message's data to the relevant record.

    We have this all working with the exception of getting the mail body in step #4. I have tried defining a ItemHasRegularExpressionMatch rule with a RegExValue of "(.*)" and then checking the value of it via the JS API, but I get back a String array with about the first 800 or so characters in the mail message. 

    Ideally we would also like to get the attachments on the email but can understand how this might be difficult through a Javascript API. 

    Thanks in advance for any assistance!

    Tuesday, September 4, 2012 9:34 PM


All replies

  • Hi tfasz - have you looked into using the makeEwsRequestAsync Exchange Web Service api - this requires a higher permission level (ReadWriteMailbox) - which means that the app must be installed by an admin - but should do what you want.

    Starter link:


    Hope this helps....patrick

    • Marked as answer by tfasz Wednesday, September 5, 2012 7:44 PM
    Wednesday, September 5, 2012 4:19 PM
  • Thanks for the help Patrick - that was the pointer I needed.

    Since everything else is available via the JS API, you might want to include something in the Office 2013 mail app docs to mention that the body is only available via the Exchange web service api. I saw the example about getting the subject via the web service but it didn't really make sense since you can get it via the JS API.

    Thanks again!

    Wednesday, September 5, 2012 7:44 PM
  • Can you please update the link as the starter link no longer works.
    Tuesday, September 11, 2012 8:48 AM
  • Hmm, we'll find the people responsible and take them out and flog them...actually the problem is that we put a ")" at the end of the url and the cut/paste functionality of this edit control seems to be against this.

    Try: http://msdn.microsoft.com/en-us/library/office/apps/fp160952(v=office.15)

    Tuesday, September 11, 2012 2:48 PM
  • Is there any solution to this task that does not require Read/Write? 
    Tuesday, November 4, 2014 11:29 PM