I've seen three types of group properties for an SPWeb
object - Groups
, SiteGroups
, AssociatedGroups
.
I understand that SiteGroups
will fetch all the groups in the current site collection. But what is the difference between Groups
and AssociatedGroups
. MSDN definition says that Groups
will get all the 'cross-site'(!) groups for that web site. AssociatedGroups
are fairly easily to understand just from the very name.
So what does Groups
return? Can somebody explain me with an example?
Groups
return all groups which have security roles assigned to the current site.
AssociatedGroups
return all groups visible in the left menu of the People and Group page
. Those groups may not have access to the current site (if the security settings do not inherit from parent site). In this case, some of them will not be listed in the Groups
property.
To view the difference, in a subsite, create a new group without giving any permission. The group will be visible in the AssociatedGroups
and Left menu, but will not be listed in Groups
or Site Permissions page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With