Jan 06 2020 02:22 PM
Scenario:
We have a working InTapp application registered in Azure with an application ID and secret key, that Read/Writes/Updates Lists on a SharePoint Online site. However, when we attempt to use it on another site on the same tenant, it will return the metadata of the list, but will fail to return any information the list items. It's registered on both SPO sites with full control (via _layouts/15/AppInv.aspx)
SAMPLESITE-WORKS (working):
Method: GET
URL: https://SAMPLEDOMAIN.sharepoint.com/sites/SAMPLESITE-WORKS/_api/web/lists/GetByTitle('ListOfPeople')
RESULT:
{"d":{"__metadata":{"id":"https://SAMPLEDOMAIN.sharepoint.com/sites/SAMPLESITE-WORKS/_api/Web/Lists(guid'b6dc17ea-e805-495a-96......
Method: GET
URL: https://SAMPLEDOMAIN.sharepoint.com/sites/SAMPLESITE-WORKS/_api/web/lists/GetByTitle('ListOfPeople')...
RESULT:
{"d":{"results":[{"__metadata":{"id":"23df63b0-b494-44d3-a6b3-0c16ff531cbd","uri":"https://SAMPLEDOMAIN.sharepoint.com/sites/SAMPLESITE-WORKS/_api/Web/Lists(guid'b6dc17ea...
SAMPLESITE-DOES-NOT-WORK (not completely working):
Method: GET
URL: https://SAMPLEDOMAIN.sharepoint.com/sites/SAMPLESITE-DOES-NOT-WORK/_api/web/lists/GetByTitle('ListOf...')
RESULT:
{"d":{"__metadata":{"id":"https://SAMPLEDOMAIN.sharepoint.com/sites/SAMPLESITE-DOES-NOT-WORK/_api/Web/Lists(guid'28ffc036-b111......
Method: GET
URL: https://SAMPLEDOMAIN.sharepoint.com/sites/SAMPLESITE-DOES-NOT-WORK/_api/lists/GetByTitle('ListOfPeop...')/items
RESULT:
{"d":{"results":[]}}
Do any of you have an idea why the "/items" end point would fail? Thanks in advance.
Jan 07 2020 02:45 AM - edited Jan 07 2020 02:47 AM
@Noel_Suarez It seems to me your call is successfull but does not retrieve any items. This can be either because there simply are no items, or maybe because permissions on the listitems are broken and the app has no inherited permissions on the libraries items.
Maybe try using /items?select=*
Standard everything should be returned, but maybe you have a specific filter already there?
Jan 10 2020 07:37 AM - edited Jan 10 2020 07:41 AM
Solution@IshtarOnline - Thanks for taking a stab at it. Sorry for the delay in responding. Actually, it something insanely dumb. On our site - in the permissions XML, we created is as:
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest
Scope="https://SAMPLESITE.sharepoint.com/sites/SAMPLE"
Right="FullControl" />
</AppPermissionRequests>
We misinterpreted the documentation, replacing the scope with OUR site, which was wrong. So it really was as it was written in the documentation.
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest
Scope="http://sharepoint/content/sitecollection"
Right="FullControl" />
</AppPermissionRequests>
There are times that it is fine to just copy and paste the documentation. Hope this post helps others. Thanks!
Jan 10 2020 07:37 AM - edited Jan 10 2020 07:41 AM
Solution@IshtarOnline - Thanks for taking a stab at it. Sorry for the delay in responding. Actually, it something insanely dumb. On our site - in the permissions XML, we created is as:
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest
Scope="https://SAMPLESITE.sharepoint.com/sites/SAMPLE"
Right="FullControl" />
</AppPermissionRequests>
We misinterpreted the documentation, replacing the scope with OUR site, which was wrong. So it really was as it was written in the documentation.
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest
Scope="http://sharepoint/content/sitecollection"
Right="FullControl" />
</AppPermissionRequests>
There are times that it is fine to just copy and paste the documentation. Hope this post helps others. Thanks!