Hi Martin,
maybe check if there is a new library version. There was a bug in one
of the previous AdWords API .NET library where the instantiation of
the adwords user which is not using app.config was not implemented
(someone forgot to do that :) and your error was always returned. They
corrected it with the new version (rather download from trunk).
Also I can give you here piece of code that works:
Dictionary<string, string> headers = new
Dictionary<string, string>();
headers["email"] = email;
headers["clientEmail"] = clientEmail;
headers["password"] = password;
headers["applicationToken"] = applicationToken;
headers["developerToken"] = developerToken;
adwordsUser = new AdWordsUser(headers);
// run in sandbox
if (sandbox)
adwordsUser.UseSandbox();
// initialize services
this.campaignService =
(AdWords.CampaignService)adwordsUser.GetService(AdWordsService.v200909.CampaignService);
this.adgroupService =
(AdWords.AdGroupService)adwordsUser.GetService(AdWordsService.v200909.AdGroupService);
this.adService =
(AdWords.AdGroupAdService)adwordsUser.GetService(AdWordsService.v200909.AdGroupAdService);
this.keywordService =
(AdWords.AdGroupCriterionService)adwordsUser.GetService(AdWordsService.v200909.AdGroupCriterionService);
this.adParamService =
(AdWords.AdParamService)adwordsUser.GetService(AdWordsService.v200909.AdParamService);
However, it actually looks very similar to your implementation.
Ales
On Feb 7, 8:36 am, majco <[email protected]> wrote:
> Hi,
>
> I have problem with constructor of AdwordsUser.
>
> I use:
> awapi_dotnet_lib_6.2.0
>
> My code:
> headers = New Dictionary(Of String, String)
> headers.Add("CompanyName", "xyz")
> headers.Add("DeveloperToken", "xyz")
> headers.Add("Email", "xyz")
> headers.Add("Password", "xyz")
> headers.Add("ClientEmail", "xyz")
>
> ret = New AdWordsUser(headers)
>
> The value xyz I replace with the real values...
>
> I get error:
> "The given key was not present in the dictionary."
>
> Where is a problem?
> Thanks
--
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en.