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:
Simplified JavaScript Library for SharePoint
PnP-JS-Core Library
SharePoint has lot of building blocks in collections which are used to form a SharePoint site. Those are used in manage the contents, generate reports based on contents & settings, etc…
In this post, we will use the PnP-JS-Core method to get the group information based on name.
Example:
The following code snippet is used to return the group object and its properties from the current SharePoint site’s group collection using PnP JavaScript library, click here to read more.
- <!-- Required JS file -->
- <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>
-
- <div id="sample"></div>
-
- <script type="text/javascript">
-
- $pnp.sp.web.siteGroups.getByName("My Team Owners").get().then(function(result) {
- document.getElementById('sample').innerHTML = "Title : " + result.Title + " <br/>Description: " + result.Description;
- });catch(function(err) {
- alert(err);
- });
- </script>