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.
JavaScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
publicgetListViewData():void{
let listName="Custom List";//The display name of the sharepoint list.
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.
Related