Forum Discussion

Clifford Adams's avatar
Clifford Adams
Copper Contributor
Dec 01, 2016
Solved

PnP-JS-Core open web by url?

Every example I see of PnP-JS-Core uses the current web. How can I open a list from another web?

  • Clifford Adams's avatar
    Clifford Adams
    Dec 02, 2016

    For anyone else searching for this. Here's how you do it:

    var w = new $pnp.Web("/news");
    w.lists.getByTitle("Alerts")....
  • have not seen the code but i guess you need to create your own clientcontext with site url and then go to the correct web.
    • Clifford Adams's avatar
      Clifford Adams
      Copper Contributor

      That's how you do it with CSOM, but PNP-Core is a wrapper for the REST services. Makes lots of things easier, but documentation is sketchy. Thanks for the response.

      • Clifford Adams's avatar
        Clifford Adams
        Copper Contributor

        For anyone else searching for this. Here's how you do it:

        var w = new $pnp.Web("/news");
        w.lists.getByTitle("Alerts")....

Resources