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