abujehad139 / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

API Key #309

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Trying to input the api key into the CustomSearchService class
2.
3.

What is the expected output? What do you see instead?
There is no attribute in the CustomSearchService to input the API key.

What version of the product are you using? On what operating system?
Latest build

Please provide any additional information below.

Original issue reported on code.google.com by Krez...@gmail.com on 7 Apr 2013 at 1:48

GoogleCodeExporter commented 9 years ago
Hi,

First of all, next time I suggest that you should open a new topic on 
StackOverflow with google-api-dotnet-client tag.

Regarding your question - CustomsearchService inherits from BaseClientService. 
BaseClientService contains ApiKey property which is set in the constructor by 
the Initializer value. 
So, If you want to set your ApiKey you should do the following:

BaseClientService.Initializer initializer = new BaseClientService.Initializer();
initializer.ApiKey = "YOUR_KEY";
// set other properties of initializer
CustomsearchService service = new CustomsearchService(initializer);

I'm closing this issue, please feel free to open it, if you need any additional 
information.

Original comment by pele...@google.com on 8 Apr 2013 at 12:23