IntroductionIn this article you will see how to get the group owner name for the specified group in SharePoint 2010 using ECMAScript. I have a site group named "MMS-CTH Members" from which I need to get the group owner name (Navigate to the site, click on Site Actions. Click on Site Settings. In the Users and Permissions section, click on People and Groups. In the left pane, click on Groups. Click on MMS-CTH Members. Click on Settings, then click on Group Settings).Steps Involved
var group;
function getGroupOwner() {
var clientContext = new SP.ClientContext(); var groupCollection = clientContext.get_web().get_siteGroups(); group = groupCollection.getById(7); clientContext.load(group); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); }
function onQuerySucceeded() { alert(group.get_title() + " group owner - " + group.get_ownerTitle()); }
function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }</script> <input id="btnGetGroupOwner" onclick="getGroupOwner()" type="button" value="Get Group Owner" />
ReferenceSP.Group.ownerTitle Property - http://msdn.microsoft.com/en-us/library/ff408766.aspx SummaryThus in this article you have seen how to get the group owner name for the specified owner in SharePoint 2010 using ECMAScript.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: