Rare Solutions
Rare Solutions

Reputation: 84

Outlook add-in to upload attachment to SharePoint Online library

Outlook Add-In should give option to user to select attachments and then a button to upload to SharePoint online. Right now,I am stuck in reading attachment content using javascript API.

I tried using callbacktoken method in javascript and used Outlook rest api to read attachment of the current mail. - Didn't work.

Any help is greatly appreciated to showcase how can I communicate to mail attachments of a selected email and then upload it to SharePoint.

Upvotes: 0

Views: 346

Answers (1)

Rare Solutions
Rare Solutions

Reputation: 84

I have done this finally by using graph, sharepoint api's.

Outlook rest api's or Javascript office js library don't allow you to read attachments or any secure content client side. So you have to create server-server solution by writing c# code to call outlook or graph api's to get this information.

Graph api to read the mail/attachment content, SharePoint api to read, write from lists, libraries.

Created Azure AD App registration and given correct permissions to Graph, SharePoint. Then used the app registration id, secret to read write content to SharePoint.

The only challenge was reply url. Please map the correct reply url and then expose the api to the correct one in manifest xml in outlook add-in. Please let me know if anyone need more information on this.

Upvotes: 0

Related Questions