Home > MOSS 2007, SharePoint 2010 > Note to Self: The Difference between SPWeb.SiteGroups & SPWeb.Groups

Note to Self: The Difference between SPWeb.SiteGroups & SPWeb.Groups

This came up a few times and I seem to forget it after a while:

  1. SPWeb.SiteGroups: As the documentation says this gets you a collection of cross-site groups for the site collection. These groups are cross-site, because they can be used in more than one SPWeb object in the site collection.
  2. SPWeb.Groups: This returns a subset of the groups above (SPWeb.SiteGroups) that are used in the specified SPWeb object. The word “used” is important to note here. These are the groups that are referenced somewhere in the site. For example, in a securable object such as an SPList or SPListItem with broken inheritance.

So, the logical conclusion is that:  SPWeb.SiteGroups >= SPWeb.Groups.

Categories: MOSS 2007, SharePoint 2010 Tags:
  1. June 17th, 2010 at 10:26 | #1

    Thanks for the tip 🙂

  2. July 27th, 2010 at 02:24 | #2

    Nice post. Thank you for the info. Keep it up.

You must be logged in to post a comment.