Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

SearchServiceClient.Search Method

This documentation is no longer available on MSDN. It is available as a CHM or PDF download. For the newest Geocoding, Imagery, Routing and Traffic services, see the Bing Maps REST Services

Performs a search based on a given query and options.

Public Function Search(ByVal request As SearchRequest) As SearchResponse



A SearchRequest object that contains the header and parameter information for the service operation. Required.

private void MakeSearchRequest()
string Results = "";
// Set a Bing Maps key before making a request
string key = "Bing Maps Key";

SearchService.SearchRequest  searchRequest = new SearchService.SearchRequest();

// Set the credentials using a valid Bing Maps key
searchRequest.Credentials = new SearchService.Credentials();
searchRequest.Credentials.ApplicationId = key;

// Set the search query and filter options
searchRequest.Query = "restaurant in Seattle, WA";
searchRequest.SearchOptions = new SearchService.SearchOptions();
searchRequest.SearchOptions.Filters = new SearchService.FilterExpression()
{ PropertyId = 3,
CompareOperator = SearchService.CompareOperator.GreaterThanOrEquals,
FilterValue = 8 };

// Make the search request
SearchService.SearchServiceClient searchService = new SearchService.SearchServiceClient("BasicHttpBinding_ISearchService");
SearchService.SearchResponse searchResponse = searchService.Search(searchRequest);

string resultList = "";
for (int i=0; i < searchResponse.ResultSets[0].Results.Length; i++)
resultList = resultList + searchResponse.ResultSets[0].Results[i].Name + "\n";

Results = resultList;

catch (Exception ex)
Results = "An exception occurred: " + ex.Message;



© 2015 Microsoft