RetrieveTeamsSystemUser Message (CrmService)
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
Find the latest SDK documentation: CRM 2015 SDK
| Works for all deployment types | Works online and offline |
Retrieves the list of teams of which the specified user is a member.
The relevant classes are specified in the following table.
| Type | Class |
| Request | RetrieveTeamsSystemUserRequest |
| Response | RetrieveTeamsSystemUserResponse |
| Entity | team |
Remarks
To use this message, pass an instance of the RetrieveTeamsSystemUserRequest class as the request parameter in the Execute method.
To perform this action, the caller must have access rights on the team entity instance. For a list of required privileges, see RetrieveTeamsSystemUser Privileges.
Note The RetrieveTeamsSystemUser message does not return all the attributes when the ColumnSet property is set to AllColumns in the RetrieveTeamsSystemUserRequest class.
Example
The following example demonstrates how to use the RetrieveTeamsSystemUser message.
[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 request.
RetrieveTeamsSystemUserRequest teamsSystemUserRequest = new RetrieveTeamsSystemUserRequest();
teamsSystemUserRequest.EntityId = ((systemuser)crmUser.BusinessEntities[0]).systemuserid.Value;
// Be aware that using AllColumns may adversely affect
// performance and cause unwanted cascading in subsequent
// updates. A best practice is to retrieve the least amount of
// data required.
teamsSystemUserRequest.ColumnSet = new AllColumns();
// Execute the request.
RetrieveTeamsSystemUserResponse teamsSystemUserResponse = (RetrieveTeamsSystemUserResponse)service.Execute(teamsSystemUserRequest);
[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 request.
Dim teamRequest As New RetrieveTeamsSystemUserRequest()
' Be aware that using AllColumns may adversely affect
' performance and cause unwanted cascading in subsequent
' updates. A best practice is to retrieve the least amount of
' data required.
teamRequest.ColumnSet = New AllColumns()
teamRequest.EntityId = New Guid("CC1DD426-CE10-DD11-9778-0003FFBDD2C7")
' Execute the request.
Dim teamResponse As RetrieveTeamsSystemUserResponse = DirectCast(service.Execute(teamRequest), RetrieveTeamsSystemUserResponse)
' Process the results.
Console.WriteLine("Teams Retrieved:")
For Each aTeam As team In teamResponse.BusinessEntityCollection.BusinessEntities
Console.WriteLine("Team ID: " & aTeam.teamid.Value.ToString())
Next
See Also
Concepts
Reference
.gif)