Shai Petel
Shai Petel

Reputation: 316

UnauthorizedAccessException for limited permissions user via REST API

not sure if this is the right place to post dev question so please point me to the right place if its not...

I have a customer that gave a user permission to one specific list.

for example:

https://[tenant].sharepoint.com/sites/qa/permissions/lists/tasks

The user cannot browse to the site:

https://[tenant].sharepoint.com/sites/qa/permissions

But he can get to the list with no problems.

When we try to get the list items using REST api, that user gets "UnauthorizedAccessException" error.

Rest API url we tried:

https://[tenant].sharepoint.com/sites/qa/permissions/_api/web/lists/getbytitle('tasks')

https://[tenant].sharepoint.com/sites/qa/permissions/_api/web/lists/getbytitle('tasks')/items

Users with at least read permissions on the site /sites/qa/permissions have no problems getting to both these API endpoints.

Thanks!

(I posted this on technet as well, and will update here if I get an answer there)

Upvotes: 0

Views: 1622

Answers (1)

Gautam Sheth
Gautam Sheth

Reputation: 2490

You can deactivate the site collection feature Limited-access user permission lockdown mode.

When this feature is activated, users with "Limited access" as permissions have reduced permissions which prevent them from accessing the list item/documents properties. This will cause the Unauthorized Exception error while accessing SharePoint artefacts.

So, go to your Site Settings > Site collection features

And Deactivate the Limited-access user permission lockdown mode feature.

After that, refresh and check.

enter image description here

More details - Enable or disable site collection features

Upvotes: 1

Related Questions