4

While learning graph API, I was trying to get a file from a SharePoint document library using Microsoft Graph API.

I first tried by accessing files in Documents from https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com

by doing this GET request:

https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com/drive/root:/Test:/children

Everything worked great, I then tried accessing documents from another site within the same tenant. I told my self it was the same pathway while following the Microsoft docs.

I first did a test request to be sure i can first access to my site; here is what I did;

https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite

On executing that query i got a 200 OK response.

Secondly I then tried accessing the drive Documents here is what i did;

https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive

again everything worked fine.

I then used the root relation followed by the name of the directory and then the children relation; and this was my request:

https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/ObserveTestSite:/drive/root:/Test:/children

But while executing that, I'm getting Bad Request - 400 - 96ms

Please help.

Thanks

4
  • Can you re-test using the failing scenario URL and share the request ID and UTC timestamp? Also re-test but change to using [hostname,site-guid, web-guid]? I have seen an issue with using relative URL where the parser isn't able to go beyond the "drive" or "drives" element and am bringing it up to the relevant PMs. See here for another question in the same space: stackoverflow.com/questions/61597024/… Commented Jun 15, 2020 at 16:51
  • Thanks for your feedback @BrianT.JackettMSFT Here is the output: "date": "2020-06-16T07:46:56" "request-id": "271e1161-734a-4684-82f0-6eeb18f842b2" The second alternative using [hostname,site-guid, web-guid] works great! Commented Jun 16, 2020 at 7:48
  • Thank you for providing that information. I'll take a look at the logs. I've seen this personally and also reported from a few other people. I have an open conversation with the API owner looking into this. Commented Jun 17, 2020 at 1:20
  • I am running into same issue and the solution provide by Jerry works. But, if I can get to the drive using site relative url then why can't i get to the drive/root (and path inside it) using site relative url. Seems like a miss in MSFT part. @brian-t-jackett-msft, any insight into this? Would have been cleaner if we can get away with not using IDs Commented Sep 12, 2024 at 4:23

1 Answer 1

7

I have the same issue when using site relative url to specify the specific site.

Now I'm using siteId instead and everything works as expected:

https://graph.microsoft.com/v1.0/sites/zheguo.sharepoint.com,91a47a59-db5e-4d17-a689-479ee8905533,274459c9-4c96-42bf-9b96-838ffa387aaa/drive/root:/X:/children
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.