Friday, February 9, 2018

Check if SharePoint Group Exists Client Object Model


Check if SharePoint Group Exists Client Object Model

Web web = clientContext.Site.RootWeb;
clientContext.ExecuteQuery();
var currentGroups = web.SiteGroups;
clientContext.Load(currentGroups);
clientContext.ExecuteQuery();
bool isGroupExists = false;
if (currentGroups.Count > 0)
{
isGroupExists = currentGroups.OfTypeGroup>().Count(g => g.Title.Equals(“Pass your groupname”, StringComparison.InvariantCultureIgnoreCase)) > 0;


}


No comments:

Post a Comment