Search code examples
sharepoint-onlinesharepoint-jsom

How to get all the subsites under a site collection if logged in user doesn't have permissions on site collection in sharepoint online using JSOM?


When I am trying to get the all subwebs under the site collection in Sharepoint online using jsom, if the logged in user doesn't have permissions on a site collection I am unable to retrieve the all subsites.

But I am able to get all the subsites under the site collection if the logged in user have permissions on site collection.

I want, even if the user have permissions on site collection retrieve the all subsites under a site collection in Sharepoint online using JavaScript.


Solution

  • That's not possible because the data is what's security trimmed to what the user has access to. Having the ability to escalate privileges client side would be a huge security breach. What people usually end up doing usually is either giving very small permissions everywhere to the all users group or using a relay custom API and a service account that has permissions.