Calling SharePoint Online REST API from an Outlook add in

Copper Contributor

Hi guys, this will be my first post on here and I am in dire need of help. Fairly obviously I'm a SP novice and appreciate any and all comments and suggestions. I've been bouncing around the interwebs looking for a simple concise answer / walkthrough to guide me on how to call the SharePoint REST API from an external client-side source (JavaScript) to no avail. 

 

I'm developing an add in which is capable of creating a item in a list, nothing more, nothing less. The resources I have found so far:

and a couple of others which I didn't find helpful.

 

Is there no simple straightforward way to recieve an access token and append that to each REST call header? I'd hoped to use the PnP JavaScript library and use the configuration function to authenticate each call automatically. This being such a general inquiry I didn't include further details, if anyone thinks they'll help, I will gladly post them :)

 

Thanks in advance,

-Ketill

2 Replies

If all you have to do is creating an item in a List you could use Microsoft Graph:

https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/listItem_create

 

JavaScript-based authentication libraries for Microsoft Graph are available depending on which version of the Azure AD endpoints you use. For a detailed description see the article below:

https://developer.microsoft.com/en-us/graph/docs/concepts/auth_overview

 

Hope this helps!

Oh, awesome it was my understanding that graph had only reached GA for sites and not for lists or list items :\ Is it still recommended to use them?