3

I have an Outlook web addin which can be used in the compose window. What the addin does is, send a request to our server with the ID of the selected file to attach (Our server is a file storage system. The user will be able to select a file and attach it to the new email). The server will prepare the file and use the Outlook Rest API to attach the file to the email: https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/version-2.0/complex-types-for-mail-contacts-calendar#referenceattachment

Sample request body:

{
    "@odata.type": "#Microsoft.OutlookServices.ReferenceAttachment", 
    "Name": "Iglue picture", 
    "SourceUrl": "https://i.imgur.com/rNIYuhi.jpg", 
    "ProviderType": "Other", 
    "Permission": "Edit", 
    "IsFolder": "False"
}

Now the file gets attached successfully. But the problem is, the user have to reload Outlook to see the attached file. So my question is how to attach the file and trigger a refresh just like the Office JS API's Office.context.mailbox.item.addFileAttachmentAsync method?

THpubs
  • 7,804
  • 16
  • 68
  • 143
  • You can't - Outlook is not aware of your changes. Try to add a dummy attachment through the Office API, and then have your server replace it. – Dmitry Streblechenko Oct 30 '19 at 16:45
  • @THpubs, by "reloading Outlook" do you mean "refreshing the browser window"? If that is the case, then this means you are using Outlook on the web? – Outlook Add-ins Team - MSFT Oct 30 '19 at 23:40
  • @OutlookAdd-insTeam-MSFTYes I'm using Outlook on the web. Did not try in the desktop yet. – THpubs Oct 31 '19 at 01:21
  • @DmitryStreblechenko Thanks but, how to replace the attachment from the server? – THpubs Oct 31 '19 at 05:58
  • @OutlookAdd-insTeam-MSFT Any help? – THpubs Nov 04 '19 at 03:44
  • @Thpubs, What i understood that you want some API which will sync item from server and refresh the UI, if it is correct then I am sorry to say that currently modifying the read / compose message body, or refreshing the item in the view, is not a part of the product (either by REST or by office.JS API). We track Outlook add-in feature requests on our user-voice page. Please add your request there. Feature requests on user-voice are considered when we go through our planning process. https://officespdev.uservoice.com/forums/224641-general/category/131778-outlook-add-ins – Outlook Add-ins Team - MSFT Nov 05 '19 at 12:10
  • Can you clarify the use case? Are you attaching something to the body of the mail and not seeing it? Is there any reason why you aren't using the `addFileAttachmentAsync`? – Mavi Domates Nov 07 '19 at 16:45
  • @MaviDomates Yes I'm trying to add some files from the REST api but can't see them in the body. The thing is I'm trying to zip the files in the back end and upload them directly. – THpubs Nov 08 '19 at 05:25

1 Answers1

-1

In OfficeJS, currently there is no way to refresh Outlook UI form with the latest data from exchange server.

We track Outlook add-in feature requests on our user-voice page. Please add your request there. Feature requests on user-voice are considered, when we go through our planning process.