Share via


RetrieveSubGroupsResourceGroupRequest.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 the QueryByAttribute class. The query must specify the entity name "resourcegroup" and a columnset. Any other conditions specified will be merged (AND) with those needed to retrieve the subgroups for the resource group.

Example

The following code example shows the use of the Query field.

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

// Create the request.
RetrieveSubGroupsResourceGroupRequest request = new RetrieveSubGroupsResourceGroupRequest();
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.
request.ResourceGroupId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

// Execute the request.
RetrieveSubGroupsResourceGroupResponse response = (RetrieveSubGroupsResourceGroupResponse)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", "resourcegroupid"}

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

' Set the properties for the request object.
retrieve.ColumnSet = cols
' ResourceGroupId is the Guid of the resourcegroup
retrieve.ResourceGroupId = New Guid("2B951FBC-1C56-4430-B23B-20A1349068F3")

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

See Also

© 2007 Microsoft Corporation. All rights reserved.