Sunday, 1 September 2013

Remove members from Team Plugin Code



        //Function to Remove members from Team
        private void RemoveMember(IOrganizationService crmServ, List<Guid> TeamMember, Guid TeamId)
        {

            #region remove members from  team
            foreach (Guid userId in TeamMember)
            {
                RemoveMembersTeamRequest removeMembereTeamRequest = new RemoveMembersTeamRequest();
                removeMembereTeamRequest.TeamId = TeamId;
                Guid[] arrayMembers = new Guid[1];
                arrayMembers[0] = userId;
                removeMembereTeamRequest.MemberIds = arrayMembers;
                RemoveMembersTeamResponse removeMembersTeamResp = (RemoveMembersTeamResponse)crmServ.Execute(removeMembereTeamRequest);
            }
            #endregion
        }