Share via


RetrieveByGroupResource Message

banner art

Retrieve all resources related to the specified resource group.

The relevant classes are specified in the following table.

Type Class
Request RetrieveByGroupResourceRequest
Response RetrieveByGroupResourceResponse
Entity resource

Remarks

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

Example

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

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

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

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

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

// ResourceGroupId is the GUID of the resource group to retrieve.
request.ResourceGroupId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

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

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

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

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

' Set the properties of the request object.
retrieve.ColumnSet = cols
' EntityId is the resource group GUID.
retrieve.EntityId = new Guid("18ECA720-493E-4800-BBFD-638BD54EB325");

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

Related Topics

CrmService Messages

© 2007 Microsoft Corporation. All rights reserved.