Hello please help me,

1.First time the data are comes correctly.
2.When try to import again it give Xml data of QueryToken which is
given below.

Version V201101

=> QueryToken Xml

<reportResponse>
 
<queryToken>CK7opxISUndFeFZCeklCQUFBPS40MlNJcU0xTktRN3FTaDZxYk9mNGxmSXM1cityU1hiZEh3bng5SzhCVjdFPS5KUEc5bmduNzlUaWdVZ2pPcE51My93PT0aGkFkIFBlcmZvcm1hbmNlIENvc3QgUmVwb3J0IAEoADACOA1AAEiedVCidWICZW5qAHIAegNVU0Q=</
queryToken>
  <state>RUNNING</state>
  <total>9</total>
  <success>0</success>
  <fail>0</fail>
</reportResponse>

=> Code

ReportDefinitionService reportDefinitionService =
(ReportDefinitionService)user.GetService(
 
Google.Api.Ads.AdWords.Lib.AdWordsService.v201101.ReportDefinitionService);
                // TODO - all conv types
                if (m_dataLoader != null)
m_dataLoader.UpdateStatus("Defining cost report job");
                _status = "Defining cost report job";
                // Create report definition.
                ReportDefinition reportDefinition = new
ReportDefinition();
                reportDefinition.reportName = reportName;
                reportDefinition.dateRangeType =
ReportDefinitionDateRangeType.CUSTOM_DATE;
                reportDefinition.dateRangeTypeSpecified = true;
                reportDefinition.reportType =
ReportDefinitionReportType.AD_PERFORMANCE_REPORT;
                reportDefinition.reportTypeSpecified = true;
                reportDefinition.downloadFormat = DownloadFormat.TSV;
                reportDefinition.downloadFormatSpecified = true;
                if(accountLoginType ==
SettingsHelper.AccountLoginType.MccOrMaster)
                    reportDefinition.crossClient = true;


                Selector selector = new Selector();
                selector.fields = new string[] {
                    "Date",
                    "ExternalCustomerId",
                    "CampaignId",
                    "AdGroupId",
                    "KeywordId",
                    "Id",
                    "AccountDescriptiveName",
                    "CustomerDescriptiveName",
                    "CampaignName",
                    "AdGroupName",
                    "CreativeDestinationUrl",
                    "Headline",
                    "Description1",
                    "Description2",
                    "DisplayUrl",
                    "Impressions",
                    "Clicks",
                    "Cost",
                    "AveragePosition",
                    "CampaignStatus",
                    "AdGroupStatus",
                    "CreativeApprovalStatus",
                    "Status",
                    "AdType",
                    "ImageAdUrl",
                    "ImageCreativeName",
                    "IsNegative",
                    "PrimaryCompanyName"

                };

                if (startDate.Equals(DateTime.MinValue))
                {
                    reportDefinition.dateRangeType =
Google.Api.Ads.AdWords.v201101.ReportDefinitionDateRangeType.LAST_30_DAYS;
                }
                else
                {
                    selector.dateRange = new
Google.Api.Ads.AdWords.v201101.DateRange();
                    string start = string.Format("{0:yyyy-MM-dd}",
startDate);
                    start = start.Replace("-", "");
                    selector.dateRange.min = start;

                    string end = string.Format("{0:yyyy-MM-dd}",
endDate);
                    end = end.Replace("-", "");
                    selector.dateRange.max = end;
                }
                reportDefinition.selector = selector;

                if (m_dataLoader != null)
m_dataLoader.UpdateStatus("Scheduling cost report job");
                _status = "Scheduling cost report job";


                ReportDefinitionOperation operation = new
ReportDefinitionOperation();
                operation.operand = reportDefinition;
                operation.@operator = Operator.ADD;
                operation.operatorSpecified = true;

                ReportDefinition[] result =
reportDefinitionService.mutate(
                new ReportDefinitionOperation[] { operation });

                if (result != null)
                {
                    foreach (ReportDefinition temp in result)
                    {
                        id = temp.id;
                    }
                }
        string fileName =
Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "App_Data\\"
+ account.LoginID.ToString() + "Cost" +
"AdWords.csv");
                    tempFilePath = fileName;
                    try
                    {
                        try
                        {
                            if(File.Exists(fileName))
                                File.Delete(fileName);
                        }
                        catch (Exception ex)
                        {

                        }
                        new
ReportUtilities(user).DownloadClientReport(id, fileName);
                        StreamReader streamReader = new
StreamReader(fileName);
                        adPerformanceCostReport =
streamReader.ReadToEnd();
                        streamReader.Close();


Regards,
Sachin

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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

Reply via email to