We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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>
$pnp.sp.web.select("Title").get()
.then(function(data){
`document.getElementById("main").innerText=data.Title;` `})`
.catch(function(data){
`document.getElementById("main").innerText=data; `
});
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"