RetrieveByGroupResource Message (CrmService)
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
| Works for all deployment types | Works online and offline |
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 use this message, pass an instance of the RetrieveByGroupResourceRequest class as the request parameter in the Execute method.
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.
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.
ColumnSet colSet = new ColumnSet();
colSet.Attributes = new string[] { "name", "resourceid" };
// Create the request.
RetrieveByGroupResourceRequest request = new RetrieveByGroupResourceRequest();
request.Query = new QueryExpression();
request.Query.ColumnSet = colSet;
request.Query.EntityName = EntityName.resource.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 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.
Dim colSet As New ColumnSet()
colSet.Attributes = New String() { "name", "resourceid" }
' Create the request.
Dim request As New RetrieveByGroupResourceRequest()
request.Query = New QueryExpression()
request.Query.ColumnSet = colSet
request.Query.EntityName = EntityName.resource.ToString()
' ResourceGroupId is the GUID of the resource group to retrieve.
request.ResourceGroupId = New Guid("2B951FBC-1C56-4430-B23B-20A1349068F3")
' Execute the request.
Dim response As RetrieveByGroupResourceResponse = CType(service.Execute(request), RetrieveByGroupResourceResponse)
See Also
Concepts
Reference
© 2010 Microsoft Corporation. All rights reserved.

