-3

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.

pavan
  • 451
  • 1
  • 5
  • 16

1 Answers1

3

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

Andrey Marchuk
  • 13,301
  • 2
  • 36
  • 52
  • I tried to log the users which is returning in "users" It is returning System.Collections.Generic.List. I had the namespace using System.Collections.Generic included. Please help. – pavan Sep 03 '12 at 11:48
  • @pavan Not sure what your problem exactly is, but I have updated my answer with your inputs – Andrey Marchuk Sep 03 '12 at 12:27