How to get the members of the group in Tridion

纵饮孤独 提交于 2019-12-14 03:36:37

问题


With the help of event handler i am getting the id of the user who have finished the Workflow activity.

For getting the Id i am writing like:

foreach(var user in activity.Performers)

userId=user.Title.ToString();

Now, similarly how can i get the members of the group(their id's) to which the user belongs.


回答1:


If you are in the event handler then you are using TOM.NET. You need to get list of users in the group. Each group has GetGroupMembers method that you can use. Here's the code you need:

foreach (var user in activity.Performers)
{
     var groupMemberships = ((User)user).GroupMemberships;

     var filter = new GroupMembersFilter(session);
     foreach (var groupMembership in groupMemberships)
     {
         var users = groupMembership.Group.GetGroupMembers(filter);
     }
}

You can control how much data you get back by setting properties of filter



来源:https://stackoverflow.com/questions/12243526/how-to-get-the-members-of-the-group-in-tridion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!