3
votes

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://docs.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?

1
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
@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
@OutlookAdd-insTeam-MSFTYes I'm using Outlook on the web. Did not try in the desktop yet.THpubs
@DmitryStreblechenko Thanks but, how to replace the attachment from the server?THpubs
@OutlookAdd-insTeam-MSFT Any help?THpubs

1 Answers

0
votes

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.