May 10 2017 01:34 PM
I'm learning on the Graph API as a whole and to access Sharepoint in particular. I figured out how to authenticate with the help of the ADAL library for Python. I can access my sharpeoint site. I can get a list of all the lists of the site. But somehow when I ask for the items in a list, I get nothing. In Graph Explorer, I get each lines.
Any idea what might be wrong? I don't understand how I can access the site and get to the list without any problem, but the items does not show up. I also have no error. I only get a "value" : [] answer, will the usuall context stuff.
Any help is appreciated.
ETienne Fortin
May 10 2017 11:08 PM
May 11 2017 03:43 AM
May 11 2017 07:16 AM
It is difficult to help without seeing the code you are running...
May 11 2017 07:26 AM
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('{...",
"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 07:48 AM
May 11 2017 09:12 AM
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 2017 10:33 AM