SPWeb.Groups 与 SPWeb.AssociatedGroups
我见过 SPWeb
对象的三种类型的组属性 - Groups
、SiteGroups
、AssociatedGroups
。
据我所知,SiteGroups
将获取当前网站集中的所有组。但是Groups
和AssociatedGroups
之间有什么区别。 MSDN 定义表示Groups
将获取该网站的所有“跨站点”(!) 组。 AssociatedGroups
从名字上就很容易理解。
那么 Groups
返回什么?有人可以用一个例子来解释我吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Groups
返回已分配给当前站点的安全角色的所有组。AssociatedGroups
返回人员和组页面
左侧菜单中可见的所有组。这些组可能无权访问当前站点(如果安全设置不是从父站点继承的)。在这种情况下,其中一些不会在Groups
属性中列出。要查看差异,请在子网站中创建一个新组而不授予任何权限。该组将在
AssociatedGroups
和左侧菜单中可见,但不会在Groups
或网站权限页面中列出。Groups
return all groups which have security roles assigned to the current site.AssociatedGroups
return all groups visible in the left menu of thePeople 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 theGroups
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 inGroups
or Site Permissions page.我相信msdn有答案
http://msdn.microsoft .com/en-us/library/microsoft.sharepoint.spweb.sitegroups.aspx
获取包含网站集中所有组的集合。
http://msdn.microsoft.com/en-us /library/microsoft.sharepoint.spweb.groups.aspx
获取包含网站所有组的集合。以下代码示例使用 Groups 属性返回当前网站集中指定网站的组集合。
这意味着,SPGroup 已在 SPWeb 的某处使用(即分配了权限)。
I believe msdn has the answer
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.sitegroups.aspx
Gets a collection that contains all the groups in the site collection.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.groups.aspx
Gets a collection that contains all the groups for the website. The following code example uses the Groups property to return the collection of groups for a specified site in the current site collection.
Which means, the SPGroup has been used in (ie assigned a permission in) the SPWeb somewhere.