How do we use the Bing API in C#? I have to pass a query to the Bing API and then get the results.
5 Answers
BingService.BingService service = new BingService.BingService();
SearchRequest request = new SearchRequest();
// use your Bing AppID
request.AppId = ""; /* Your App ID */
request.Query = "rose"; // your search query
// I want to search only web
request.Sources = new SourceType[]
{
SourceType.Image
};
SearchResponse response = service.Search(request);
foreach (ImageResult result in response.Image.Results)
{
//lstBxImages.Items.Add("<a href="+result.Url + '"'+"></a>" + result.Title);
imgliteral.Controls.Add(new LiteralControl("<img src=" + result.MediaUrl + " width=100
1 Comment
Oghenero E.
what are the things i need to runn this code, and where do i get them?
Download bing dlls from microsoft site and add those dlls . Then only we can able to use bing service.
1 Comment
Oghenero E.
Hello, any links for where these dlls can be downloaded?
Just adding to above there is a full documentation of te API given by BING in a PDF.