public void DownloadReport(GoogleUserEntity user, long reportId, string Path = @"c:\testingAdwords.zip")
 {
     //========================== Retriever =======================================================
     try
     {
         // Download report.
         new ReportUtilities(user.adwordsUser).DownloadReportDefinition(reportId, Path);
     }
     catch (Exception ex)
     {
         throw new Exception("Failed to download report. Exception says" + ex.Message);
     }
     //======================== End of Retriever =================================================
 }
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                log.AppendText("creating AdwordsReport ....\n ");
                //AdwordsReport _googleReport = new AdwordsReport();
                GoogleUserEntity user = new GoogleUserEntity(MccEmail.Text, email.Text);
                //_googleReport.user = new GoogleUserEntity(email.Text, email.Text);
                log.AppendText("creating reportService ....\n ");
                ReportDefinitionService reportService = (ReportDefinitionService)user.adwordsUser.GetService(AdWordsService.v201101.ReportDefinitionService);
                long report_id;
                long.TryParse(reportId.Text, out report_id);

                log.AppendText("downloading report ....\n ");
                DownloadReport(user, report_id, path.Text);
            }
            catch (Exception ex)
            {
                log.AppendText(ex.Message.ToString());
            }

            log.AppendText("Done ! \n");
        }
        private void GetFieldsList(ReportDefinitionReportType ReportType)
        {
            AdWordsAppConfig config = new AdWordsAppConfig()
            {
                Email            = this.MccEmail.Text,
                Password         = this.MccPassword.Text,
                DeveloperToken   = "5eCsvAOU06Fs4j5qHWKTCA",
                ApplicationToken = "5eCsvAOU06Fs4j5qHWKTCA",
                //ClientEmail = "*****@*****.**",
                UserAgent             = "Edge.BI",
                EnableGzipCompression = true
            };

            GoogleUserEntity userEntity = new GoogleUserEntity(this.MccEmail.Text, this.validEmail.Text, true, this.connectionString.Text);
            //AdWordsUser user = new AdWordsUser(new AdWordsServiceFactory().ReadHeadersFromConfig(config));
            var reportService = (ReportDefinitionService)userEntity.adwordsUser.GetService(AdWordsService.v201101.ReportDefinitionService);

            //AdwordsReport _googleReport = new AdwordsReport(95, txt_mcc.Text, validEmail.Text, "", "");
            ReportDefinitionField[] reportFields = reportService.getReportFields(ReportType);
            foreach (ReportDefinitionField field in reportFields)
            {
                this.dataGridView1.Rows.Add(field.fieldName, field.fieldType, field.canSelect, field.canFilter, field.displayFieldName);
            }
        }