0

I followed codes sample here with security trim to get a list of sub site titles that user have access.

I got

Access denied. You do not have permission to perform or access this resource.

Is there a solution for this? The users have read-only at the root site and contribute at subside.

Below is the codes:

http://site/_api/web/webs/?$select=title,effectivebasepermissions&$filter=effectivebasepermissions/high%20gt%2032
0

If i run this as a Visitor on my root site I get

Access denied. You do not have permission to perform this action or access this resource.

as well. So it is safe to assume that you need a higher permission to call this method.

I'd say that you need at least manageWeb permission to run it.

0

"Webs" (whether in CSOM, REST APIs or server side code) always requires manageweb to run.

A possible solution might be to use the search API to list items of site type. For instance, a call like this:

https://server/_api/search/query?querytext=%27contentclass=%22STS_Web%22%27

would display webs. You would need to filter on the "ParentLink" property to get webs from a particular web.

The advantage of this is that it is security trimmed, so the user will only see what they have permission to see.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.