How to get SharePoint Groups using Javascript in SP2013 ?
<script type="text/javascript">
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups";
var requestHeaders = { "accept" : "application/json;odata=verbose" };
$.ajax({
url : requestUri,
contentType : "application/json;odata=verbose",
headers : requestHeaders,
success : onSuccess,
error : onError
});
function onSuccess(data, request){
var s='';
for (var i = 0; i < data.d.results.length; i++)
{
s +=data.d.results[i].LoginName+'\n';
}
alert(s);
}
function onError(error) {
alert("error");
}
</script>
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups";
var requestHeaders = { "accept" : "application/json;odata=verbose" };
$.ajax({
url : requestUri,
contentType : "application/json;odata=verbose",
headers : requestHeaders,
success : onSuccess,
error : onError
});
function onSuccess(data, request){
var s='';
for (var i = 0; i < data.d.results.length; i++)
{
s +=data.d.results[i].LoginName+'\n';
}
alert(s);
}
function onError(error) {
alert("error");
}
</script>
Comments
Post a Comment