//Check if a group exists in a website var groupInWeb = GroupExistsInWebSite(SPContext.Current.Web, "MyGroupName"); //Check if a group exists in a site collection var groupInSite = GroupExistsInSiteCollection(SPContext.Current.Web, "MyGroupName"); private bool GroupExistsInWebSite(SPWeb web, string name) { return web.Groups.OfType<SPGroup>().Count(g => g.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) > 0; } private bool GroupExistsInSiteCollection(SPWeb web, string name) { return web.SiteGroups.OfType<SPGroup>().Count(g => g.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) > 0; }
Wednesday, 23 July 2014
Checking if Sharepoint SP group exists?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment