开发者

How to select category of Bing News Results?

开发者 https://www.devze.com 2023-02-11 18:42 出处:网络
Hi I am trying to retrieve news(Bing Search API) from a 1 of the 8 categories Bing offers. Check Documentation Here.

Hi I am trying to retrieve news(Bing Search API) from a 1 of the 8 categories Bing offers.

Check Documentation Here.

According to the documentation it should take in a string with one of the values listed in the page above. But everytime I apply it:

request.Query = "Football";
request.Sources = new SourceType[] { SourceType.News };
request.News.Category =开发者_JAVA技巧 "rt_ScienceAndTechnology";//Error comes here

This returns a "null reference exception". Any replies and suggestions would be greatly appreciated.


I think you need to initialise request.News before setting Request.News.Category like this

request.News = new NewsRequest();

taken from here: http://msdn.microsoft.com/en-us/library/dd251024.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消