Share via


RetrieveByResourcesService Message

banner art

Retrieves the collection of services related to the specified set of services.

The relevant classes are specified in the following table.

Type Class
Request RetrieveByResourcesServiceRequest
Response RetrieveByResourcesServiceResponse
Entity service

Remarks

To perform this action, the caller must have access rights on the service entity instance. For a list of required privileges, see RetrieveByResourcesService Privileges.

Example

The following code example shows how to use the RetrieveByResourcesService message.

[C#]
// Set up the CRM Service.
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the request.
RetrieveByResourcesServiceRequest request = new RetrieveByResourcesServiceRequest();
service sv = new service();

// Create the column set.
ColumnSet colSet = new ColumnSet();
colSet.Attributes = new string[] {"name", "serviceid"};

// Set up the query.
request.Query = new QueryExpression();
request.Query.ColumnSet = colSet;
request.Query.EntityName = "service";

// ResourceIds are the Resource GUIDs part of the service. 
request.ResourceIds = new Guid[] {new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3"), new Guid("18ECA720-493E-4800-BBFD-638BD54EB325")};

// Execute the request.
RetrieveByResourcesServiceResponse response = (RetrieveByResourcesServiceResponse)service.Execute(request);

[Visual Basic .NET]
' Set up the CRM Service.
Dim service As New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the column set.
Dim cols As New ColumnSet()
cols.Attributes = New String() {"name"}

' Create the request object.
Dim retrieve As New RetrieveByResourcesServiceRequest()

' Set the properties of the request object.
retrieve.ColumnSet = cols

' ResourceIds are the Resource GUIDs part of the service.
retrieve.ResourceIds = {New Guid("2B951FBC-1C56-4430-B23B-20A1349068F3"), New Guid("18ECA720-493E-4800-BBFD-638BD54EB325")}

' Execute the request.
Dim retrieved As RetrieveByResourcesServiceResponse = CType(service.Execute(retrieve), RetrieveByResourcesServiceResponse)

Related Topics

CrmService Messages

© 2007 Microsoft Corporation. All rights reserved.