Bing API in Action: Search with C#
Filed in C#, Code Snippets on Jul.08, 2009
Here is a quick code on Bing API with C#.
- First you need to create a BING AppID which you can do it here
- You need to add web reference to http://api.search.live.net/search.wsdl?AppID=YourAppId in your project
- In the sample code provided, I used only necessary settings. There are more. So refer to Bing API Documentation
- Below is the screenshot of the source code.
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); } } } }
Related posts:























July 18th, 2009 at 7:11 am
[...] old blog post: http://blog.ninethsense.com/bing-api-in-action-search-with-c/ VN:F [1.1.6_502]Rating: 0.0/5 (0 votes cast) [...]