Export (0) Print
Expand All
Expand Minimize

RetrieveByResourcesService Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online and offline

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

The relevant classes are specified in the following table.

TypeClass
RequestRetrieveByResourcesServiceRequest
ResponseRetrieveByResourcesServiceResponse
Entityservice

Remarks

To use this message, pass an instance of the RetrieveByResourcesServiceRequest class as the request parameter in the Execute method.

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.
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 column set of attributes to return for each resource group.
ColumnSet colSet = new ColumnSet();
colSet.Attributes = new string[] { "name" };

RetrieveByResourcesServiceRequest retrieve = new RetrieveByResourcesServiceRequest();
retrieve.Query = new QueryExpression();
retrieve.Query.ColumnSet = colSet;
retrieve.Query.EntityName = EntityName.service.ToString();

// Set IDs of the services related to the specified set of services.
retrieve.ResourceIds =  new Guid[] {new Guid("A0F2D8FE-6468-DA11-B748-000D9DD8CDAC")};

RetrieveByResourcesServiceResponse retrieved = 
    (RetrieveByResourcesServiceResponse)service.Execute(retrieve);
[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 column set of attributes to return for each resource group.
Dim colSet As New ColumnSet()
colSet.Attributes = New String() { "name" }

Dim retrieve As New RetrieveByResourcesServiceRequest()
retrieve.Query = New QueryExpression()
retrieve.Query.ColumnSet = colSet
retrieve.Query.EntityName = EntityName.service.ToString()

' Set IDs of the services related to the specified set of services.
retrieve.ResourceIds =  New Guid[] {New Guid("A0F2D8FE-6468-DA11-B748-000D9DD8CDAC")}

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

See Also


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft