<script type="text/javascript">
var currentcontext = null;
var currentweb = null;
ExecuteOrDelayUntilScriptLoaded(GetGroups, "sp.js");
function IteratethroughGroup()
{
currentcontext = new SP.ClientContext.get_current();
currentweb = currentcontext.get_web();
this.groupCollection = currentweb.get_siteGroups();
currentcontext.load(this.groupCollection);
currentcontext.executeQueryAsync(Function.createDelegate(this, this.ExecuteOnSuccess),
Function.createDelegate(this, this.ExecuteOnFailure));
}
function ExecuteOnSuccess(sender, args) {
var listEnumerator = this.groupCollection.getEnumerator();
while (listEnumerator.moveNext()) {
var item = listEnumerator.get_current();
groupName = item.get_title();
alert(groupName);
}
}
function ExecuteOnFailure(sender, args) {
alert("error");
}
</script>
Related : Get current user's group Ecmascript\Javascript Client Object model SharePoint 2010
Ads by Google
jhhjjh
ReplyDelete