1

I'm struggling to find how Sharepoint works.
My goal is to upload a file to the 'Document Center' of my company from php using the Graph.
I think DocumentLibraries are seen as drives but I can't find the name or ID of the Document folder.

GET https://graph.microsoft.com/beta/sites/mycompany.sharepoint.com/drive/{ID TO FIND}/children

How can I find this ID ? (and if you know how i can find childrens IDs, it could be interesting)

2

First you can get the libraries data:

https://graph.microsoft.com/beta/sites/{hostName}:/{optionalSubsiteUrl}:/drives

example:

https://graph.microsoft.com/beta/sites/yoursite.sharepoint.com:/sites/testsite:/drives

You will get list of all drives with theirs' id (Property called id). Next you can access drive items like this:

https://graph.microsoft.com/v1.0/drives/{driveId}/root/children

Hope it will help:)

  • THANKS ! (I forgot the "/sites" between the host and the site when i tried server-relative path) – Milan Rodriguez Sep 2 '17 at 19:18
  • With Java API getting a site with path this works : msGraphClient.sites("MyDomain.sharepoint.com:/sites/MySite:") Don't forget : for domain AND site. Working with V1.0 Graph API. – Maxence Nov 19 '18 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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