Export (0) Print
Expand All
Expand Minimize

ExecuteByIdUserQuery Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online and offline

Executes the user query (saved view) that has the specified ID.

The relevant classes are specified in the following table.

TypeClass
RequestExecuteByIdUserQueryRequest
ResponseExecuteByIdUserQueryResponse
Entityuserquery

Remarks

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

To perform this action the caller must have access rights on the entity instances retrieved. For a list of required privileges, see ExecuteByIdUserQuery Privileges.

This message returns a String type that specifies the XML data containing the results of the query. This XML string is in the following format:

<resultset> + <result>result1</result><result>result2</result> + ... + </resultset> 

The XML string returned from this method may contain multiple entity instances. If no instances are returned, the method simply returns an XML document for the entity type, with no data.

The XML string returned from this method does not contain elements for attributes where the value is null or contains empty strings. This improves performance by not sending more XML data than is necessary from the server to the client.

Example

The following code example demonstrates how to use the ExecuteByIdUserQuery 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 request object.
ExecuteByIdUserQueryRequest query = new ExecuteByIdUserQueryRequest();

// Set the properties of the request object.
query.EntityId = new Guid("07D5B0B3-136C-48C6-8EAC-0030B9466E78");

// Execute the request.
ExecuteByIdUserQueryResponse queried = (ExecuteByIdUserQueryResponse) service.Execute(query);
[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 request object.
Dim query As New ExecuteByIdUserQueryRequest()

' Set the properties of the request object.
query.EntityId = New Guid("07D5B0B3-136C-48C6-8EAC-0030B9466E78");

' Execute the request.
Dim queried As ExecuteByIdUserQueryResponse = CType(service.Execute(query), ExecuteByIdUserQueryResponse)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft