Returns an ADO.NET DataSet containing a DataTable for each search results set returned for the specified query.
Web service reference: http://Site/_vti_bin/Search.asmx
[SoapDocumentMethodAttribute("http://microsoft.com/webservices/OfficeServer/QueryService/QueryEx", RequestNamespace = "http://microsoft.com/webservices/OfficeServer/QueryService", ResponseNamespace = "http://microsoft.com/webservices/OfficeServer/QueryService", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)] public DataSet QueryEx( string queryXml )
For queries containing a simple list of search terms, set the type attribute for the QueryText Element in Microsoft.Search.Query Schema to 'STRING'. For SQL syntax queries, set the type attribute to 'MSSQLFT'.
If anonymous access is disabled for the Query web service's web application, you must specify the credentials for the web service request using the Credentials property. The search results are trimmed based on the credentials of the current context of the request.
The DataSet returned by the QueryEx method can contain multiple result sets. Each result set will be a DataTable within the DataSet. The DataTable name is based on the types of results included in the result set for that DataTable. These are:
The default sort order is relevance rank.
Using elements from the Microsoft.Search.Query schema, you can specify the following for the result set returned by the Query web method:
Managed properties to include in the results, using the Property Element in Microsoft.Search.Query Schema.
Properties for sorting the results and the sort order direction, using the SortByProperty Element in Microsoft.Search.Query Schema.
Whether stemming is enabled, using the EnableStemming Element in Microsoft.Search.Query Schema.
Whether duplicates are collapsed, using the TrimDuplicates Element in Microsoft.Search.Query Schema.
Whether noise words are ignored, using the IgnoreAllNoiseQuery Element in Microsoft.Search.Query Schema.
The following code example shows how to invoke the Query method. This example assumes the following:
You have referenced the web service proxy class, here called QueryWebServiceProxy, in your code.
You have instantiated a string variable, queryXMLString, and set the value of this variable to the XML string containing the search query.
QueryWebServiceProxy.QueryService queryService = new QueryWebServiceProxy.QueryService(); queryService.Credentials = System.Net.CredentialCache.DefaultCredentials; string queryResultsString = queryService.Query(queryXMLString);
Setting the proxy class Credentials property to the DefaultCredentials property of the CredentialCache class allows you to use the credentials for the identity that the client application is running under for the web service request.