ReportDefinition definition = new ReportDefinition()
{
reportName = "Last 7 days CRITERIA_PERFORMANCE_REPORT",
reportType = ReportDefinitionReportType.CRITERIA_PERFORMANCE_REPORT,
downloadFormat = DownloadFormat.XML,
dateRangeType = ReportDefinitionDateRangeType.LAST_7_DAYS,
selector = new Selector()
{
fields = new string[]
{"CampaignId", "AdGroupId", "Id", "CriteriaType", "Criteria",
"FinalUrls", "Clicks", "Impressions", "Cost"
},
predicates = new Predicate[]
{
Predicate.In("Status", new string[] {"ENABLED", "PAUSED"})
}
},
};
(user.Config as AdWordsAppConfig).IncludeZeroImpressions = true;
string filepath = Server.MapPath("data.xml");
try
{
ReportUtilities utilities = new ReportUtilities(user,"v201609",definition);
using (ReportResponse response = utilities.GetResponse())
{
response.Save(filepath);
}
Response.Write("Report downloaded"+ filepath);
}
catch(Exception ex)
{
string a = ex.Message;
}
I am not able to understand where I am going wrong please help me.
Any help appreciated.