0
votes

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

1
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/…Brian T. Jackett MSFT
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!The_Thinker
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.Brian T. Jackett MSFT

1 Answers

1
votes

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