I'm trying to get data out of a O365 Sharepoint Project Online (PWA) enviroment.
When I login to the O365/Sharepoint environment and navigate in the browser to: https://my.sharepoint.com/sites/pwa/_api/ProjectData/Projects
I get a large XML with the data I can request in /ProjectData/Projects
That works fine. Now I want to query this data in Chrome Postman but that doesn't work
In Postman:
When I choose
GET
and insert the link (above), selectNo Auth
I recieve<?xml version="1.0" encoding="utf-8"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <m:code>-2147024891, System.UnauthorizedAccessException</m:code> <m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</m:message> </m:error>
When I choose
GET
and insert the link (above), selectBasic Auth
and give my credentials I have used to login on, the then again I recieve<?xml version="1.0" encoding="utf-8"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <m:code>-2147024891, System.UnauthorizedAccessException</m:code> <m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</m:message> </m:error>
After some search I've found that this could be due to a missing authentication token (oAuth2), so I tried to request that token using this nice tutorial Sharepoint Online oAuth.
After following the tutorial I got an access token.
When I choose
GET
and insert the link (above), selectOAuth 2.0
and choose to add token to the header. In the Headers tab insert Key -> Authorization and Value -> Bearer ************* (Access token) then again<?xml version="1.0" encoding="utf-8"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <m:code>-2147024891, System.UnauthorizedAccessException</m:code> <m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource. </m:message> </m:error>
What am I doing wrong? Is it so hard to get data out of Projects Online?