c# - Only Remove SPGroups that Contain a specific Character -


I need to remove groups from a SharePoint site that has an underscore in the name. I need something like the one below, but I am unable to use it. Is present on CollGroups

Any ideas how can I do this? Using

  (sps ite osite = new sps ite (spat)) {{SPWeb oWeb = oSite.OpenWeb ()} {SPGroupCollection CollGroups = oWeb.SiteGroups; If (collGroups.Contains ("_")) // This does not work, but I want something like this group {group.Delete (); For future reference: This is what I am writing, thanks. Gunr2171 to point me in the right direction! Using  
  (sps ite osite = new sps ite (spat)) {{SPWeb oWeb = oSite.OpenWeb ()) {var results = (from OWeb.Groups.OfType & lt; SPGroup & gt; () where choose g.Name.Contains ("_") g) .toList (); Foreign Currency (resulting SPG Group Group) {SP Group Control Group = OWB Group Group; CollGroups.Remove (group.Name); Console.light line ("expelled" + group name); } Console.WriteLine ("Process Complete!"); }  

Comments