Monday, July 27, 2015

Add/Remove Members to Team

Hi all,

Please find the Plugin Code to Add and Remove Members to a Team using C#

//Add Members to Team

public static void AddMembersToTeam(Guid teamId, Guid[] membersId, IOrganizationService service)
        {
            // Create the AddMembersTeamRequest object.
            AddMembersTeamRequest addRequest = new AddMembersTeamRequest();

            // Set the AddMembersTeamRequest TeamID property to the object ID of
            // an existing team.
            addRequest.TeamId = teamId;

            // Set the AddMembersTeamRequest MemberIds property to an
            // array of GUIDs that contains the object IDs of one or more system users.
            addRequest.MemberIds = membersId;

            // Execute the request.
            service.Execute(addRequest);
        }

//RemoveMembers to Team

        public static void RemoveMembersFromTeam(Guid teamId, Guid[] membersId, IOrganizationService service)
        {
            // Create the AddMembersTeamRequest object.
            RemoveMembersTeamRequest addRequest = new RemoveMembersTeamRequest();

            // Set the AddMembersTeamRequest TeamID property to the object ID of
            // an existing team.
            addRequest.TeamId = teamId;

            // Set the AddMembersTeamRequest MemberIds property to an
            // array of GUIDs that contains the object IDs of one or more system users.
            addRequest.MemberIds = membersId;

            // Execute the request.
            service.Execute(addRequest);
        }

No comments:

Post a Comment

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...