public void AddSecurityRoletoTeam(IOrganizationService service, Guid securityRoleId, Guid teamId)
{
service.Associate(Team.EntityLogicalName,
teamId,
new Relationship("teamroles_association"),
new EntityReferenceCollection() { new EntityReference(Role.EntityLogicalName, securityRoleId) });
}
*Both Team and Security Role should be in the same Business Unit
Hope it helps!

Like
Report
*This post is locked for comments