Forum Discussion
Different behavior between graph explorer and calling the API directly
It is difficult to help without seeing the code you are running...
I authenticate with ADAL and get a token. Then I create a header like this:
headers = {
'User-Agent' : 'SharepointBridge/1.0',
'Authorization' : 'Bearer %s' % (tk),
'Accept' : 'application/json',
'Content-Type' : 'application/json'
}
Where tk contains my token.
My request to Graph is done like that:
r = requests.get('https://graph.microsoft.com/beta/sites/XXXXXXX.sharepoint.com,XXXXXX,XXXXXXX/lists/{list_id}/items', headers = headers)
I can query anything below "items". But /items returns:
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#sites('XXXXXXXsharepoint.com%2CXXXXXX%2CXXXXXX')/lists('{list_id}')/items",
"value": []
}
If I do the exact same query in Graph Explorer, I get my list with all the information, not an empty value.
- May 11, 2017- Are you sure that your application requested and received consent for Sites.Read.All?
- Is it a large list, and perhaps being throttled?
- Try using Postman to issue the call with your app id/token.- Etienne FortinMay 11, 2017Copper Contributor
It can't get any stupider than that. Your first question did it. I assigned all the permissions I needed (delegated) in Azure Portal, to my app, including the one you mention. However I didn't press "grant". So they were not really effectives I guess. Still doesn't understand why I had some but not others. But now it works. I get the items.
Thanks for pointing me out to the obvious :) Looks like I needed it to resolve my "issue".
- May 11, 2017Excellent. Glad it is working now.