0
votes

So I am not sure where I am going wrong but here goes!

I want to list files on my test Sharepoint site via the MS GraphAPI. This via the documentation should be simple but it's just not happening!

I am using the GraphAPI explorer https://developer.microsoft.com/en-us/graph/graph-explorer/preview

I then can see my site and its shared folder via this call

https://graph.microsoft.com/v1.0/sites/MyCompany.sharepoint.com:/sites/burf-test:/drive

I get back:

    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
    "createdDateTime": "2020-04-19T05:47:58Z",
    "description": "",
    "id": "b!BWveRisE5UWH2b_vq03PZYmZdMdKpQtFhpIQSacsCowq3ZxYLFsFQKtzuZ4-V1ya",
    "lastModifiedDateTime": "2020-04-30T13:50:28Z",
    "name": "Documents",
    "webUrl": "https://-.sharepoint.com/sites/Burf-Test/Shared%20Documents",
    "driveType": "documentLibrary",
    "createdBy": {
        "user": {
            "displayName": "System Account"
        }
    },
    "owner": {
        "group": {
            "email": "[email protected]",
            "id": "e48afefa-2aa8-4cd5-aad9-62f746a991c2",
            "displayName": "Burf-Test Owners"
        }
    },
    "quota": {
        "deleted": 0,
        "remaining": 0,
        "total": 0,
        "used": 0
    }
}

I can not find a way to list the files that I can see via my Sharepoint portal (Burf-Test)? Tried

  • /drive/root/children
  • /drive/b!BWveRisE5UWH2b_vq03PZYmZdMdKpQtFhpIQSacsCowq3ZxYLFsFQKtzuZ4-V1ya
  • /drives/b!BWveRisE5UWH2b_vq03PZYmZdMdKpQtFhpIQSacsCowq3ZxYLFsFQKtzuZ4-V1ya
  • /drive/Documents
  • /lists etc

and a whole lot more!

1

1 Answers

0
votes

So the main issue here was actually permissions, sometimes the Graph Explorer will say Access denied, and sometimes it will return a 200 but not show the files. Both mean a permissions issue.

I found I had to grant extra permissions (File ones) to get this to work

https://graph.microsoft.com/v1.0/sites/a-.sharepoint.com,SITE-GUID/drives/FOLDER-GUID/root/children