RE: List of all users and their teams
Hi,
If you are familiar with Console Application C# code then you can copy paste below sample code to getlist of users with the teams -
Dictionary userTeamLists = new Dictionary();
// Get List of Users
string userQuery = $@"
";
EntityCollection userEntities = crmSvc.RetrieveMultiple(new FetchExpression(userQuery));
foreach (var user in userEntities.Entities)
{
Guid userId = user.Id;
// Get List of Teams Associated to the user
string teamQuery = $@"
";
EntityCollection teamEntities = crmSvc.RetrieveMultiple(new FetchExpression(teamQuery));
StringBuilder teamNames = new StringBuilder();
foreach (var item in teamEntities.Entities)
{
string teamName = item.GetAttributeValue("name");
teamNames.Append(teamName);
teamNames.Append(",");
}
userTeamLists.Add(userId.ToString(), teamNames.ToString());
}
If you want to export the list as cvs then you can easily convert dictionary objectto csv file.
Please mark my answer verified if this is helpful!
Regards,
Bipin Kumar
Follow my Blog: xrmdynamicscrm.wordpress.com/