Share via


RetrieveByGroupResourceRequest.Query Field

banner art

Specifies the query for the operation.

Syntax

[Visual Basic .NET]
Public Field Query As QueryBase
[C#]
public QueryBase Query;
[JScript]
public var Query : QueryBase;

Remarks

Assign an instance of the QueryExpression class or QueryByAttribute class. The query must specify the entity name "resourcegroup" and a column set. Any other conditions specified will be merged (AND) with those needed to retrieve the resources for the specified service group.

Example

The following code example shows how to use the Query field.

[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()

// TemplateId is the GUID of the template to make unavailable.
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 Resource Group Guid
retrieve.EntityId = new Guid("18ECA720-493E-4800-BBFD-638BD54EB325");

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

See Also

© 2007 Microsoft Corporation. All rights reserved.