How to Delete multiple Groups in MOSS 2007


  • I am doing some house cleaning and consolidated alot of groups with in SharePoint (MOSS 2007). Now I have several  groups in which I do not need over several site collections.

    I know I can go to Site Actions/People and Groups/Groops and select a single group and delete from there. But I may be deleting 10 - 15 groups per site collection, and have 10 site collections to work on.

    Is there a way to remove (delete) multiple groups in SharePoint at once from a site collection?
    Wednesday, August 06, 2008 6:48 PM




    you can work it out by using Object Model. Mainly functional class here is SPGroups. The code shown below is an example of Deleting all cross site groups from the root web of a site collection.


    private void DeleteAllSiteGroups(SPWeb rootWeb)

    SPGroupCollection corssSiteGrps = rootWeb.SiteGroups;
    ArrayList siteGrpsDeleteArray = new ArrayList();
    for (int i = 0; i < corssSiteGrps.Count; i++)


    foreach (object item in siteGrpsDeleteArray)


    You can reference this link: 

    Hope it can help you.


    Xing-Bing Yu
    Friday, August 08, 2008 8:19 AM