Get all Users & Email Id’s from “Group User/Member” using Core Services

Agenda: In one of my projects, customer needed send notifications email’s to all users who belong to certain group when they are triggering a workflow.

Obviously, many of us immediately classify this as simple (or) easy (or) low complexity task. Which is probably true, if you have done this before... Only one added twist, the list should contain all users who are members of this group, including sub-groups (groupmembers of the same group).

Many of us are already familiar how to get all the Users using “UserFilterData” and Groups info by using “GroupFilterData” from the CME using Core Services, but after brainstorming for couple of hours finally achieved & so just wanted share with others...

One more thing from CME’s we can only get User Id and Description but there is no way to get direct email id of the user, but one of the way to achieve is by adding/concatenate the email id in the description field.

Go to CME - User Management – Go to User and add the “Email ID” beside the description

Below are the steps:

  • Now get the User who is performing the activity in the Workflow
  • After getting the activity instance – then get the User ID & other Details from that activity
  • Once I get the user details – now get the all Groups where the User belongs to, then check for specific Group
  • Then create Filter for using GroupMembersFilterData and then pass the “group id” and “filter” to get all the Users in that group using below method: GetList(groupMembership.Group.IdRef, groupMembersFilter)
  • Once you get list of all User’s – iterate and get the description and using regex find the email-id from description, create List <strings> and add each user email back to list.


For more clarity please refer the below screen shot: