Calling SharePoint Online REST API from an Outlook add in

%3CLINGO-SUB%20id%3D%22lingo-sub-92288%22%20slang%3D%22en-US%22%3ECalling%20SharePoint%20Online%20REST%20API%20from%20an%20Outlook%20add%20in%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-92288%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20guys%2C%20this%20will%20be%20my%20first%20post%20on%20here%20and%20I%20am%20in%20dire%20need%20of%20help.%20Fairly%20obviously%20I'm%20a%20SP%20novice%20and%20appreciate%20any%20and%20all%20comments%20and%20suggestions.%20I've%20been%20bouncing%20around%20the%20interwebs%20looking%20for%20a%20simple%20concise%20answer%20%2F%20walkthrough%20to%20guide%20me%20on%20how%20to%3CSTRONG%3E%20call%20the%20SharePoint%20REST%20API%20from%20an%20external%20client-side%20source%3C%2FSTRONG%3E%20(%3CEM%3EJavaScript%3C%2FEM%3E)%20to%20no%20avail.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20developing%20an%20add%20in%20which%20is%20capable%20of%20creating%20a%20item%20in%20a%20list%2C%20nothing%20more%2C%20nothing%20less.%20The%20resources%20I%20have%20found%20so%20far%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdev.office.com%2Fsharepoint%2Fdocs%2Fsp-add-ins%2Fauthorization-code-oauth-flow-for-sharepoint-add-ins%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAuth%20for%20SP%20add%20ins%3C%2FA%3E%26nbsp%3B(The%20add-in%20is%20still%20in%20developement%20and%20there%20are%20no%20JS%20examples)%3C%2FLI%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdev.office.com%2Fdocs%2Fadd-ins%2Fdevelop%2Fdialog-api-in-office-add-ins%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EOutlook%20Dialog%20API%3C%2FA%3E%26nbsp%3B(I'd%20need%20some%20more%20precise%20instructions%20for%20O365%20access)%3C%2FLI%3E%3C%2FUL%3E%3CP%3Eand%20a%20couple%20of%20others%20which%20I%20didn't%20find%20helpful.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20no%20simple%20straightforward%20way%20to%20recieve%20an%20access%20token%20and%20append%20that%20to%20each%20REST%20call%20header%3F%20I'd%20hoped%20to%20use%20the%20PnP%20JavaScript%20library%20and%20use%20the%20configuration%20function%20to%20authenticate%20each%20call%20automatically.%20This%20being%20such%20a%20general%20inquiry%20I%20didn't%20include%20further%20details%2C%20if%20anyone%20thinks%20they'll%20help%2C%20I%20will%20gladly%20post%20them%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%2C%3C%2FP%3E%3CP%3E-Ketill%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-92288%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOutlook%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-92491%22%20slang%3D%22en-US%22%3ERe%3A%20Calling%20SharePoint%20Online%20REST%20API%20from%20an%20Outlook%20add%20in%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-92491%22%20slang%3D%22en-US%22%3EOh%2C%20awesome%20it%20was%20my%20understanding%20that%20graph%20had%20only%20reached%20GA%20for%20sites%20and%20not%20for%20lists%20or%20list%20items%20%3A%5C%3C%2Fimg%3E%20Is%20it%20still%20recommended%20to%20use%20them%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-92450%22%20slang%3D%22en-US%22%3ERe%3A%20Calling%20SharePoint%20Online%20REST%20API%20from%20an%20Outlook%20add%20in%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-92450%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20all%20you%20have%20to%20do%20is%20creating%20an%20item%20in%20a%20List%20you%20could%20use%20Microsoft%20Graph%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fapi-reference%2Fbeta%2Fapi%2FlistItem_create%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fapi-reference%2Fbeta%2Fapi%2FlistItem_create%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJavaScript-based%20authentication%20libraries%20for%20Microsoft%20Graph%20are%20available%20depending%20on%20which%20version%20of%20the%20Azure%20AD%20endpoints%20you%20use.%20For%20a%20detailed%20description%20see%20the%20article%20below%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fconcepts%2Fauth_overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fdocs%2Fconcepts%2Fauth_overview%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional 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
Highlighted

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!

Highlighted
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?