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)?

1 Answer 1

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 [email protected] --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.

1
  • working with new version of pnp-core-js --> 3.0.1
    – Goshky
    Commented Sep 22, 2017 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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