I am trying to use the Google CustomSearch API for .NET using sample code from the following places:
The basic code in its simplest form looks like this:
string apiKey = "my-api-key";
string cseKey = "my-cse-id";
string query = "search query";
var bcsi = new BaseClientService.Initializer { ApiKey = apiKey };
var css = new CustomsearchService(bcsi);
var listRequest = css.Cse.List(query);
listRequest.Cx = cseKey;
Search search = listRequest.Fetch();
However, when I try to compile this, I get the following error:
'Google.Apis.Customsearch.v1.CseResource.ListRequest' does not
contain a definition for 'Fetch' and no extension method 'Fetch'
accepting a first argument of type
'Google.Apis.Customsearch.v1.CseResource.ListRequest' could be found
As far as I can tell, I have all the necessary library files (I used NuGet to install the Google APIs). When I look at the API documentation, I don’t see the method Fetch(), however, all the code in the code that I could find shows a method call listRequest.Fetch().
https://developers.google.com/resources/api-libraries/documentation/customsearch/v1/csharp/latest/classGoogle_1_1Apis_1_1Customsearch_1_1v1_1_1CseResource_1_1ListRequest-members.html