SPGroup - 获取子组
我当前正在使用以下代码获取用户所属的组列表:
SPUser user = SPContext.Current.Web.CurrentUser;
var groupNames = (from SPGroup userGroup in user.Groups select userGroup.Name).ToList();
我现在需要做的是遍历每个返回任何子组的 SPGroup。 有谁知道我怎样才能实现这一目标?
问候
I am currently getting a list of groups a user is a member of using the following code:
SPUser user = SPContext.Current.Web.CurrentUser;
var groupNames = (from SPGroup userGroup in user.Groups select userGroup.Name).ToList();
What I now need to do, is itterate through each SPGroup returning any child groups.
Does anyone know how I can achieve this?
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为
SPGroup
不能有 SPGroup 的子级。SPGroup
具有SPUser
子级。但SPUser
可以是域组(IsDomainGroup
属性:http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spuser.isdomaingroup.aspx)。这意味着域用户和组将保留为SPUser
对象。I think a
SPGroup
cannot have children that are SPGroup. AnSPGroup
has chilren that areSPUser
. But aSPUser
can be a domain group (IsDomainGroup
property: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spuser.isdomaingroup.aspx). Which means that domain user and groups are kept asSPUser
objects.