Re: "The given key was not present in the dictionary"

2014-11-06 Thread Derek Gray
Your solution worked like a charm! 

Thanks Josh.

On Wednesday, 5 November 2014 22:23:44 UTC, Josh Radcliff (AdWords API 
Team) wrote:
>
> Hi,
>
> The error you mentioned is a reporting error, so my guess is that you 
> encountered that because you were using the GetAccountHierarchy.cs 
> <https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/v201409/AccountManagement/GetAccountHierarchy.cs>
>  example 
> to get all accounts under an MCC and then tried to run a report for each of 
> those accounts, but some of those accounts were MCC accounts. You can avoid 
> the *ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH* error 
> by only submitting report requests for accounts where 
> ManagedCustomer.canManageClients 
> <https://developers.google.com/adwords/api/docs/reference/v201409/ManagedCustomerService.ManagedCustomer#canManageClients>
>  is 
> *false*. Accounts where that value is *false* are standard (non-MCC) 
> AdWords accounts.
>
> Regarding the dictionary error, if that's occurring at line 94 
> <https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/v201409/AccountManagement/GetAccountHierarchy.cs#L94>
>  then 
> my guess is that the predicate you added to the ManagedCustomerService.get 
> request was for *CanManageClients = false*. With that predicate, the 
> ManagedCustomerService.get will only return standard AdWords accounts in 
> the ManagedCustomerPage.entries[] 
> <https://developers.google.com/adwords/api/docs/reference/v201409/ManagedCustomerService.ManagedCustomerPage#entries>.
>  
> Therefore the customerIdToCustomerNode dictionary in the example won't 
> have entries for any of the manager (MCC) account IDs, so when the loop at 
> line 92 tries to look up the managed customer for each link in 
> ManagedCustomerPage.links[] 
> <https://developers.google.com/adwords/api/docs/reference/v201409/ManagedCustomerService.ManagedCustomerPage#links>,
>  
> it fails. I'd remove that predicate and then use the approach I mentioned 
> in the first paragraph.
>
> Cheers,
> Josh, AdWords API Team
>
> On Wednesday, November 5, 2014 9:31:07 AM UTC-5, Derek Gray wrote:
>>
>> After I resolved an issue with the 
>> "ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISATCH" by adding a 
>> predicate to filter "CanManageClients", I started to get an error saying 
>> "The given key was not present in the dictionary".
>>
>> This is what it looks like currently:
>> Dictionary customerIdToCustomerNode = new 
>> Dictionary();
>> 
>> // Create account tree nodes for each customer.
>> foreach (ManagedCustomer customer in page.entries
>> ) {.
>>
>> Any help would be greatly appreciated.
>>
>>
>> Thanks, 
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/ff17a355-d244-4759-841e-ef8d3ade3639%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: "The given key was not present in the dictionary"

2014-11-05 Thread Josh Radcliff (AdWords API Team)
Hi,

The error you mentioned is a reporting error, so my guess is that you 
encountered that because you were using the GetAccountHierarchy.cs 
<https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/v201409/AccountManagement/GetAccountHierarchy.cs>
 example 
to get all accounts under an MCC and then tried to run a report for each of 
those accounts, but some of those accounts were MCC accounts. You can avoid 
the *ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH* error by 
only submitting report requests for accounts where 
ManagedCustomer.canManageClients 
<https://developers.google.com/adwords/api/docs/reference/v201409/ManagedCustomerService.ManagedCustomer#canManageClients>
 is 
*false*. Accounts where that value is *false* are standard (non-MCC) 
AdWords accounts.

Regarding the dictionary error, if that's occurring at line 94 
<https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/v201409/AccountManagement/GetAccountHierarchy.cs#L94>
 then 
my guess is that the predicate you added to the ManagedCustomerService.get 
request was for *CanManageClients = false*. With that predicate, the 
ManagedCustomerService.get will only return standard AdWords accounts in 
the ManagedCustomerPage.entries[] 
<https://developers.google.com/adwords/api/docs/reference/v201409/ManagedCustomerService.ManagedCustomerPage#entries>.
 
Therefore the customerIdToCustomerNode dictionary in the example won't have 
entries for any of the manager (MCC) account IDs, so when the loop at line 
92 tries to look up the managed customer for each link in 
ManagedCustomerPage.links[] 
<https://developers.google.com/adwords/api/docs/reference/v201409/ManagedCustomerService.ManagedCustomerPage#links>,
 
it fails. I'd remove that predicate and then use the approach I mentioned 
in the first paragraph.

Cheers,
Josh, AdWords API Team

On Wednesday, November 5, 2014 9:31:07 AM UTC-5, Derek Gray wrote:
>
> After I resolved an issue with the 
> "ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISATCH" by adding a 
> predicate to filter "CanManageClients", I started to get an error saying 
> "The given key was not present in the dictionary".
>
> This is what it looks like currently:
> Dictionary customerIdToCustomerNode = new 
> Dictionary();
> 
> // Create account tree nodes for each customer.
> foreach (ManagedCustomer customer in page.entries) 
> {.
>
> Any help would be greatly appreciated.
>
>
> Thanks, 
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/bd65edb1-49cd-46f7-8817-c3a4e35137e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


"The given key was not present in the dictionary"

2014-11-05 Thread Derek Gray
After I resolved an issue with the 
"ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISATCH" by adding a 
predicate to filter "CanManageClients", I started to get an error saying 
"The given key was not present in the dictionary".

This is what it looks like currently:
Dictionary customerIdToCustomerNode = new 
Dictionary();

// Create account tree nodes for each customer.
foreach (ManagedCustomer customer in page.entries) 
{.

Any help would be greatly appreciated.


Thanks, 

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/3282d252-d01e-4a32-af78-ed0cf8e22e78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.