6

I am looking to grant an application access to write to our SharePoint Online lists. We have Azure AD setup as an option. I don't want to prompt users for authentication/access, I want the app to get a token and then access SPO.

I got as far as creating the AAD App registration, and I can get the token from there, but I can't get into SharePoint. The App reg has Permissions to SPO

enter image description here

But my gut is that I need to allow this access in my site collection, and that's where everything goes dark. No idea where/how to do that. If I'm even on the right path.

UPDATE

I tried going down the Graph path, but to read/write list items is in Beta, and even that wasn't working, see other post https://stackoverflow.com/questions/44554169/access-sharepoint-sites-lists-via-microsoft-graph

2
  • have you looked at provider hosted apps with app-only token ? Commented Jun 14, 2017 at 6:49
  • I haven't, this is a headless service accessing SP, doesn't fit the traditional app model. Commented Jun 19, 2017 at 19:33

2 Answers 2

1

To access your SharePoint online site from any APP using preferred technology Microsoft Graph is the best way to do that.

Microsoft Graph exposes multiple APIs from Office 365 and other Microsoft cloud services through a single endpoint: https://graph.microsoft.com.

You can read below article to understand and get started.

Overview of Microsoft Graph API

Get Started with Microsoft Graph API

Working with SharePoint sites in Graph API

8
  • Right, but the app will be writing to the list as well, my understanding the Graph doesn't support that side of it. Commented Jun 13, 2017 at 19:54
  • 1
    Here is an article explains the operations you can do on a list item. developer.microsoft.com/en-us/graph/docs/api-reference/beta/… Commented Jun 13, 2017 at 19:58
  • How does an app gain access now? Graph is very user-centric but I want generic application access to write to a list. Combing through documentation and samples.... Commented Jun 13, 2017 at 20:08
  • 1
    This requires the user to log in and authorize, unless I'm missing something Commented Jun 13, 2017 at 20:29
  • 1
    HOWEVER the page below your linked page appears to be what I need. Chasing this down, developer.microsoft.com/en-us/graph/docs/concepts/… Commented Jun 13, 2017 at 20:31
0

To write item sharepoint list your app should have below permission

Permission type Permissions- (from least to most privileged) Delegated (work or school account) -Sites.Manage.All Application- Sites.ReadWrite.All

Post URl: POST https://graph.microsoft.com/v1.0/sites/{site-id}/lists

POST /sites/{site-id}/lists Content-Type: application/json

{   "name": "customer list",   "columns": [
    {
      "name": "name",
      "text": { }
    },
    {
      "name": "address",
      "text": { }
    }   ],   "list": {
    "template": "genericList"   } }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.