TechNet
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize
The document is archived and information here might be outdated

ValidateSavedQuery Message (CrmService)

Dynamics
banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

Works for all deployment typesWorks online and offline

Validates a saved query (view).

The relevant classes are specified in the following table.

TypeClass
RequestValidateSavedQueryRequest
ResponseValidateSavedQueryResponse
Entitysavedquery

Remarks

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

To perform this action, the caller must have access rights on the entity instance specified in the request class. For a list of required privileges, see ValidateSavedQuery Privileges.

Example

The following code example shows how to use the ValidateSavedQuery 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.
ValidateSavedQueryRequest validate = new ValidateSavedQueryRequest();

// Set the properties of the request object.
// Be aware that using all-attributes may adversely affect
// performance and cause unwanted cascading in subsequent 
// updates. A best practice is to retrieve the least amount of 
// data required.
validate.FetchXml = "<fetch mapping=\"logical\"><entity name=\"account\"><all-attributes/></entity></fetch>";

// Execute the request.
ValidateSavedQueryResponse validated = (ValidateSavedQueryResponse) service.Execute(validate);
[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 validate As New ValidateSavedQueryRequest()

' Set the properties of the request object.
' Be aware that using all-attributes may adversely affect
' performance and cause unwanted cascading in subsequent 
' updates. A best practice is to retrieve the least amount of 
' data required.
validate.FetchXml = "<fetch mapping=""logical""><entity name=""account""><all-attributes/></entity></fetch>"

' Execute the request.
Dim validated As ValidateSavedQueryResponse = CType(service.Execute(validate), ValidateSavedQueryResponse)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2016 Microsoft