AddMembersTeam Message (CrmService)
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
Find the latest SDK documentation: CRM 2015 SDK
| Works for all deployment types | Works online only |
Adds members to a team.
The relevant classes are specified in the following table.
| Type | Class |
| Request | AddMembersTeamRequest |
| Response | AddMembersTeamResponse |
| Entity | team |
Remarks
To use this message, pass an instance of theAddMembersTeamRequestclass as the request parameter in the Execute method.
To perform this action, the caller must have access rights on the entity instance specified in the request class. For a list of required privileges, see AddMembersTeam Privileges.
Example
The following code example demonstrates how to add a set of users to a team.
[C#]
// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0;
token.OrganizationName = "AdventureWorksCycle";
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Create the AddMembersTeamRequest object.
AddMembersTeamRequest addRequest = new AddMembersTeamRequest();
// Set the AddMembersTeamRequest TeamID property to the object ID of
// an existing team.
addRequest.TeamId = new Guid("9AF74EF9-A04C-DA11-A0C5-000D9DD8CDAC");
// Set the AddMembersTeamRequest MemberIds property to an
// array of GUIDs that contains the object IDs of one or more system users.
addRequest.MemberIds = new Guid[] {new Guid("A0F2D8FE-6468-DA11-B748-000D9DD8CDAC")};
// Execute the request.
AddMembersTeamResponse addResponse = (AddMembersTeamResponse)service.Execute(addRequest);
[Visual Basic .NET]
' Set up the CRM Service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials
' Create the AddMembersTeamRequest object.
Dim addRequest As AddMembersTeamRequest = New AddMembersTeamRequest
' Set the AddMembersTeamRequest TeamID property to the object ID of
' an existing team.
addRequest.TeamId = New Guid("9AF74EF9-A04C-DA11-A0C5-000D9DD8CDAC")
' Set the AddMembersTeamRequest MemberIds property to an
' array of GUIDs that contains the object IDs of one or more system users.
addRequest.MemberIds = New Guid() {New Guid("A0F2D8FE-6468-DA11-B748-000D9DD8CDAC")}
' Execute the request.
Dim addResponse As AddMembersTeamResponse = CType(service.Execute(addRequest), AddMembersTeamResponse)
See Also
Reference
.gif)