Hi,
We can make use of the following function for retrieving the members of a particular team
It takes as parameter instance of a ICrmService(CRM 4.0) or CrmService (CRM 3.0) and the guid of the team and returns an arraylist of of all the members found in the team
public ArrayList GetMembersOfTeam(ICrmService service, String TeamID)
{
// We want the guid of the system users in the team
ColumnSet cols = new ColumnSet(new String[] { “systemuserid” });
// We need to make use of RetrieveMembersTeamRequest class for that
RetrieveMembersTeamRequest rmtRequest = new RetrieveMembersTeamRequest();
// Converting the string TeamID to guid
Guid headGuid = new Guid(TeamID);
rmtRequest.EntityId = headGuid;
rmtRequest.MemberColumnSet = cols;
RetrieveMembersTeamResponse retrieved = (RetrieveMembersTeamResponse)service.Execute(rmtRequest);
// using generic businessEntity list
List<BusinessEntity> sysResult = retrieved.BusinessEntityCollection.BusinessEntities;
// for CRM 3.0
// BusinessEntity[] sysResult = retrieved.BusinessEntityCollection.BusinessEntities;
ArrayList userGuid = new ArrayList();
foreach (BusinessEntity be in sysResult)
{
systemuser user = (systemuser)be;
userGuid.Add(user.systemuserid.Value.ToString());
}
return userGuid;
}
Bye
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

I agreed with you
LikeLike
Hi, could you please show this sample code but with dynamics 365? thanks
LikeLike