2

I want to use PnP JS Core in SPFx v1.0.2 React webpart for SP16 On-premise server .

  • What is the version of pnp need to use and how to install it?
  • What are the other options for accessing data in SP with this version(1.0.2)?
3

SPFx for SharePoint 2016 currently uses Typescript 2.1.x.

The pnp compatible version for that is version 2.0.8. The latest version 3.0.0 throws some errors because of some breaking changes.

To install that, you need to run the below command:

npm install sp-pnp-js@2.0.8 --save

Update - the latest version 3.0.x works just fine, just that you need to setup the library as below:

pnp.setup({
    sp: {
        headers: {
            "Accept": "application/json; odata=verbose"
        }
    }
});

To install it, just need to run the below command:

npm install sp-pnp-js@latest --save

Reference - Moving from PnP JS core 2.0.x to 3.0.x

PnP JS core configuration

The alternate to that is to use the sphttpclient to perform CRUD operations.

You can find an excellent example here. Check the noFramework webpart.

  • Thank u:) Best regards! – Goshky Sep 20 '17 at 13:32
  • working with new version of pnp-core-js --> 3.0.1 – Goshky Sep 22 '17 at 18:58

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.