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:
- 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.
- 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
Thanks for the tip 🙂
Nice post. Thank you for the info. Keep it up.