Does anyone ever check if user is site collection admin in SharePoint 2010 in ECMA script? I googled around and can’t find any working solutions. It’s very weird that they make it so hard to do the check in SharePoint 2010.
Thanks,
Perry
Hi,
Add the content editor webpart ,edit the webpart and type the following code.
<script language=”ecmascript” type=”text/ecmascript”>
var group;
function Groupowner(){
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()+”groupowner- ” +group.get_ownerTitle());
}
function OnQueryFailed(sender, args)
{
alert(‘Requested failed’+args.get-message()+’\n’+args.get_stackTrace());
}
<input id=”btnGetGroupOwner” onclick=”getGroupOwner()” type=”button” value=”Get Group Owner” />
I hope it’ll help you