Forum Discussion
SharePoint Framework SPFx - change site collection scope
Hi folks,
I'm trying to access a List from a different site collection (in this case the MySite of the user).
Currently I do it like this with PnP JS Core:
let web = new Web(webUrl); web.lists.ensure(listTitle);
Then the REST API request "/_api/web/lists/getByTitle('Some list')" fails with a HTTP 403.
And when I take a look with Fiddler I can see that all the FedAuth stuff is missing. When I execute the request manually directly on the MySite everything works fine. So my user has the desired permissions.
So what is the best practice to "change the context" here and access other site collections than the one where the web part is placed on?
- paulpaschaBronze Contributor
I think this has to do with scripting capabilities being turned off by default for Personal Sites, see the following article:
- Robin GüldenpfennigBrass ContributorHi Paul,
I don't think so because I just want to access the REST API with the PnP JS Core Framework. When I access the API manually it works fine.
I need to instantiate a new web context where my authentication information is transferred, that's the problem I think.
- Naveen JangirCopper Contributor
Robin Güldenpfennig - Did you ever find solution? i am running in same scenario and trying to figure out how can i change the context to access MySite in my SPFx webpart
- Robin GüldenpfennigBrass Contributor
Hi Naveen,
unfortunately I didn't find any solution for this issue.