开发者

SPGroup - Get Child groups

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


I think a SPGroup cannot have children that are SPGroup. An SPGroup has chilren that are SPUser. But a SPUser 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 as SPUser objects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜