Here is a quick code on Bing API with C#.

  1. First you need to create a BING AppID which you can do it here
  2. You need to add web reference to http://api.search.live.net/search.wsdl?AppID=YourAppId in your project
  3. In the sample code provided, I used only necessary settings. There are more. So refer to Bing API Documentation
  4. Below is the screenshot of the source code.

image

Here goes the source code:

using System;
using System.Windows.Forms;
 
using WindowsFormsApplication1.MyBingService;
 
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            LiveSearchService service = new LiveSearchService();
 
            SearchRequest request = new SearchRequest();
            request.AppId = "put_your_AppID_her_please"; // use your Bing AppID
            request.Query = "ninethsense"; // your search query
 
 	    // I want to search only web
            request.Sources = new SourceType[] { SourceType.Web }; 
 
 
            SearchResponse response = service.Search(request);
 
            foreach (WebResult result in response.Web.Results)
            {
                listBox1.Items.Add(result.Title + " URL: " + result.Url);
            }
        }
    }
}
VN:F [1.1.6_502]
Rating: 0.0/5 (0 votes cast)
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • LinkedIn
  • Live
  • MySpace
  • StumbleUpon
  • Technorati

Related posts:

  1. CodeProject Article: Bing API in Action with C#
  2. Bing! Bing! Bing!
  3. Bing Submit url
  4. Microsoft’s Bing Search is live today
  5. Your first SQLite program on .NET