JSOM
<input type='button' value='Get All Groups' onclick="clickMethod();"/>
<br />
<script language="javascript" type="text/javascript">
var siteGroups ='';
function clickMethod() {
var clientContext = new SP.ClientContext.get_current();
siteGroups = clientContext.get_web().get_siteGroups();
clientContext.load(siteGroups);
clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);
}
function onQuerySucceeded() {
var allGroups='Group Name: Group ID '+'\n';
for (var i =0 ; i < siteGroups.get_count(); i++)
{
allGroups +=siteGroups.itemAt(i).get_title()+' '+siteGroups.itemAt(i).get_id()+'\n';
}
console.log(allGroups);
}
function onQueryFailed() {
alert('Request failed.');
}
</script>\
Rest Api
http://s07ngo:40072/_api/web/roleassignments/groups
No comments:
Post a Comment