Skip to content

Instantly share code, notes, and snippets.

Created September 25, 2016 05:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
This code snippets helps to create a new group in SharePoint site collection using PnP JS library
//Author: Shantha Kumar T
//Supports: SharePoint Online, SharePoint 2013+
//PnP JavaScript file available from
//More details:
<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">
//The below PnP property used to create a new SharePoint Group
Title: "Group Name"
}).then(function(result) {
var grpInfo = "";
var grp =;
grpInfo += "SharePoint Group '<strong>" + grp.Title + "</strong>' created successfully!<br/>";
grpInfo += "Below are some of the newly created group properties,<br/>";
grpInfo += "Description :" + grp.Description; + "<br/>";
grpInfo += "AllowMembersEditMembership: " + grp.AllowMembersEditMembership + "<br/>";
grpInfo += "OnlyAllowMembersViewMembership: " + grp.OnlyAllowMembersViewMembership + "<br/>";
grpInfo += "AllowRequestToJoinLeave: " + grp.AllowRequestToJoinLeave + "<br/>";
grpInfo += "AutoAcceptRequestToJoinLeave: " + grp.AutoAcceptRequestToJoinLeave + "<br/>";
grpInfo += "RequestToJoinLeaveEmailSetting: " + grp.RequestToJoinLeaveEmailSetting + "<br/>";
document.getElementById("sample").innerHTML = grpInfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment