-
Notifications
You must be signed in to change notification settings - Fork 227
Install and Use
-
NPM Install
npm install sp-pnp-js --save -
Import to TypeScript file
import pnp from "sp-pnp-js"; -
Begin using the API
pnp.sp.web.get().then(...)
You can also import parts of the library into your project to use them directly:
import { objectIsNull } from "sp-pnp-js/lib/utils/args";
let b = objectIsNull(null); //true
-
**Download pnp.js from here ???
-
**Upload pnp.js to your site. In this example we will upload it to a library called "Style Library"
-
Add a new file called pnptest.html to the same library with the following content.
<script type="text/javascript" src="{PathToYourSite}/Style%20Library/pnp.js"></script>
<script type="text/javascript" src="{PathToYourSite}/Style%20Library/pnptest.js"></script>
<div id="main">
</div>
-
Add a new file called testpnp.pnptest.js to the same library with the following content.
-
Add a Content Editor WebPart to a page within the site/
-
** Set the url of the content editor webpart to "{PathToYourSite}/Style%20Library/pnptest.html"
Sharing is caring!