Search in Windows SharePoint Services includes the Query Web service, which exposes the search capabilities to client applications.
Note In this context, "client application" refers to applications calling the Query Web service; this could include ASP.NET Web applications, Windows Form applications, etc.
The QueryEx Web method of the Query Web service sends a query to the search service, and returns the results in a System.Data.DataSet.
Procedures
To submit a keyword query to Windows SharePoint Services Search from a client application
Code
//The string containing the keyword to use in the search
string keywordString = "Microsoft";
//The XML string containing the query request information
//for the Web service
string qXMLString = "<QueryPacket xmlns='urn:Microsoft.Search.Query'>"+
"<Query><SupportedFormats><Format revision='1'>"+
"urn:Microsoft.Search.Response.Document:Document</Format>"+
"</SupportedFormats><Context><QueryText language='en-US' type='STRING'>"+
keywordString + "</QueryText></Context></Query></QueryPacket>";
QueryWebServiceProxy.QueryService queryService = new QueryWebServiceProxy.QueryService();
queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
System.Data.DataSet queryResults = queryService.QueryEx(qXMLString);
resultsGridView.DataSource = queryResults.Tables[0];
See Also