开发者

Bing API ".Count" property not working?

开发者 https://www.devze.com 2023-02-21 04:20 出处:网络
I have been trying to bring back 20 results of images using the Bing API. Here\'s the code: SearchRequest request = new SearchRequest();

I have been trying to bring back 20 results of images using the Bing API. Here's the code:

SearchRequest request = new SearchRequest();
request.AppId = APPID;
request.Q开发者_运维知识库uery = HttpUtility.HtmlEncode(searchQuery);
request.Sources = new SourceType[] { SourceType.Image };
request.Image = new ImageRequest();
request.Image.Count = 20;
request.Image.Filters = new string[1] { "Size:Medium" };

Now everything on here works, including the Image.Filters property. Just not the Count property. Is there a known bug or am I just missing something here?


I'm not sure really sure about this but I think you are missing setting CountSpecified property. Try this

request.Image = new ImageRequest();
request.Image.Offset = 0;
request.Image.Count = 20;
request.Image.CountSpecified = true;
request.Image.Filters = new string[1] { "Size:Medium" };
0

精彩评论

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