PnP-JS-Core library contains the number of extensible methods and properties, using which, we can achieve various actions in a simple code. To know more about this library component, visit the below links:
In this post, we will discuss how to get default View URL from all lists in a SharePoint site using PnP-JS-Core library.
Example
The following code snippet returns title and default View URL from all lists in a SharePoint site, under browser console, using PnP JavaScript library. Click here to read more.
- <script type="text/javascript" src="/siteassets/scripts/fetch.js"></script>
- <script type="text/javascript" src="/siteassets/scripts/promise.min.js"></script>
- <script type="text/javascript" src="/siteassets/scripts/pnp.min.js"></script>
-
- <script type="text/javascript">
- $pnp.sp.web.lists.select('Title', 'DefaultViewUrl').get().then(function(data) {
- for (var i = 0; i < data.length; i++) {
- console.log(data[i].Title + " - " + data[i].DefaultViewUrl);
- }
- });
- </script>