2

I am using Office.js in development of outlook addin.

In the context of appointment item compose mode I need to get the attachments details through office.js API. How can I get these details through Office.js API?

I found API Async methods to add attachment to item and remove attachment from item in compose mode but not able to find the details of attached attachments.

Please, Provide the solution.

swiftBoy
  • 35,607
  • 26
  • 136
  • 135

2 Answers2

0

Unless it's changed recently, you need to use Exchange Web Services (EWS), which then requires the highest permission level. To use EWS from an add-in, you'll need to use Office.context.mailbox.makeEwsRequestAsync - I believe there are other options to get a token if you prefer to make EWS calls from your server side code.

lgaud
  • 2,430
  • 20
  • 30
  • Thanks Lgaud, except Exchange Web Services (EWS) is there any way of getting the attachments through the Office.js or through rest service. If it's possible through the rest service then in compose mode how can i fire the rest call of that item because Item Id won't available in compose mode. – shravan nagothi Nov 16 '16 at 08:48
  • It may be possible via the Office365 services as well (note those are mainly for people with their mailboxes hosted on Office 365, not On Prem exchange). You can get the id of an item in Compose mode using the SaveAsync method. – lgaud Nov 16 '16 at 13:53
0

It is possible to get the attachments for a compose message by doing the following:

  1. Call Office.context.mailbox.item.saveAsync to save your message as a draft, which will return an itemId in the callback.

  2. You can now use that itemId along with the Attachements Rest API to retrieve the attachments

  • Thanks Andrew, Here my question is on Appointment not on message, If i use Office.context.mailbox.item.saveAsync to save it as draft ,that means without user intervention i am saving the item. Other than this is there any way of getting Item Id of appointment in compose mode ? – shravan nagothi Jan 29 '17 at 06:40
  • No, unfortunately the item needs to be saved somewhere for exchange to give the item an ID to be used. – Andrew Nichols - Microsoft Jan 30 '17 at 19:01