How to download named report C#

Showing 1-7 of 7 messages
How to download named report C# road11 7/16/12 11:48 AM
Using the C# v201109_1 code samples as a model, I'm trying to download one of our many previously defined and named reports. Here's the code that Google gave us to get our report definitions that isn't working (assuming a valid AdwordsUser object)...

      ReportDefinitionService reportDefinitionService = (ReportDefinitionService) user.GetService(
      // Create the selector.
      ReportDefinitionSelector selector = new ReportDefinitionSelector();
      try {
        // Get all report definitions.
        ReportDefinitionPage page = reportDefinitionService.get(selector);
        // Display report definitions.
        if (page != null && page.entries != null && page.entries.Length > 0) {
          foreach (ReportDefinition reportDefinition in page.entries) {
            writer.WriteLine("ReportDefinition with name \"{0}\" and id \"{1}\" was found.",
        } else {
          writer.WriteLine("No report definitions were found.");
      } catch (Exception ex) {
        throw new System.ApplicationException("Failed to retrieve report definitions.", ex);

...however, this code keeps telling me that page.entries is null. We've got at least 1400 named reports defined in this Google Adwords account. How is it possible that this code can find none of them? I thought the selector might be the problem, but the ReportDefinitionSelector doesn't even have a fields property, so that can't be the issue. 

I would be most grateful if someone could post a (working) C# example of how to get a list of available reports and how to download a single named report from an Adwords account.

Thank you in advance.
Re: How to download named report C# Dorian Kind 7/17/12 4:16 AM
You probably know this, but if the reports were originally defined in the UI, they will not be available via the API. Apart from that, I can't offer any help but I'd recommend using ad hoc reports instead of the ReportDefinitionService (which will be deprecated anyway).

Re: How to download named report C# road11 7/17/12 5:11 AM
Thank you, Dorian. No, I didn't know that. I've been slinging Microsoft code for nearly 20 years, but still relatively new to the Adwords API with .Net. So I have to create an ad-hoc report with C# and then I can call it by it's id? Might you know of some C# examples where I can see where you do this?

Thanks in advance for your kind response.

Re: How to download named report C# Dorian Kind 7/18/12 3:05 AM
Hi Eric,

I have absolutely zero knowledge of C#, but this link might help you to get a general idea about ad hoc reports: <>
It's basically a synchronous HTTP request with your report definition as data, returning the desired report.

Hope this helps,
Re: How to download named report C# Kevin Winter 7/24/12 1:50 PM
Hi Eric,
  Here's the DotNet client library example for downloading a Criteria Report via AdHoc reports:

Please note that you can optionally use AWQL to download reports now too (which is even easier):

- Kevin Winter
AdWords API Team
Re: How to download named report C# Ro 8/6/12 1:20 PM
Hey Kevin,

I saw in the example that there is a use of ReportDefinition - If I use this object it still free (rate wise) as the adhoc reports?

Isn't it a part of the ReportDefinitionService, which soon will be shut off?  

Looking forward for your reply!


Re: How to download named report C# Kevin Winter 8/7/12 10:51 AM
Hi Ro,
  Yes, the object has been removed from the WSDL, but all the client libraries have added support regardless.  Some are using a patched version from v201109_1, some are using the XSD directly (with generated classes).  If the example in the library does it that way, it should be safe to use.

- Kevin Winter
AdWords API Team