Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SPWeb.Groups vs SPWeb.AssociatedGroups

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?

like image 796
NLV Avatar asked Jan 19 '11 12:01

NLV


1 Answers

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.

like image 90
Sam B Avatar answered Sep 18 '22 13:09

Sam B