Retrieve data from SharePoint list via PnP JS and CAML Query

In this article I will be showing you how to retrieve list view items using PnP JS and CAML Query. For those who aren’t familiar with PnP JS, Don’t panic!  The Patterns and Practices JavaScript Core Library (aka PnP JS) was created to simplify API calls in SharePoint environments. Using PnP JS Core Libraries, we can avoid all the standard boilerplate code and focus on our application logic.

Additional information relating to the PnP JavaScript Core library can be found on the GitHub wiki for the project.

Back to our Article

In the sample code below we will query a SharePoint list. This is a two step process where we Initially retrieve the list View’s View XML based on the list name and view name. The View Query can  then passed to the next method to retrieve view items.

Leave a Reply