2012-09-20 2 views
0

여기에 내가 뭘 내용은 다음과 같습니다Google 애드워즈 v201206 후에 .NET 클라이언트 GetClientReport 문제

Selector selector = new Selector(); 
selector.fields = new string[] {"CampaignId", "AdGroupId", "Id", "CriteriaType", "Criteria", "CriteriaDestinationUrl", "Clicks", "Impressions", "Cost"}; 
Predicate predicate = new Predicate(); 
predicate.field = "Status"; 
[email protected] = PredicateOperator.IN; 
predicate.values = new string[] { "ACTIVE", "PAUSED" }; 
selector.predicates = new Predicate[] { predicate }; 

ReportDefinition definition = new ReportDefinition(); 
definition.reportName = "criteria report"; 
definition.reportType = ReportDefinitionReportType.CRITERIA_PERFORMANCE_REPORT; 
definition.downloadFormat = DownloadFormat.XML; 
definition.dateRangeType = ReportDefinitionDateRangeType.YESTERDAY; 
definition.selector = selector; 
definition.includeZeroImpressions = true; 

_handler.RunReport(new AdWordsUser(), definition); 

을 그리고 여기 내 처리기 방법입니다 :

Report contents are invalid. - !!!2|||-1|||[ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH @ selector]??? 
: 내가 단계별로

public void RunReport(AdWordsUser user, ReportDefinition definition) 
{ 

    if (definition != null) 
    { 

     string reportContents = string.Empty; 

     try 
     { 
      ReportUtilities utilities = new ReportUtilities(user); 
      utilities.ReportVersion = "v201206"; 
      ClientReport report = utilities.GetClientReport(definition); 
      reportContents = report.Contents.ToString(); 
     } 
     catch (Exception ex) 
     { 
      _errorHandler.AddError(ex); 
     } 
    } 
} 

이 오류가

해결 방법을 찾으려고 몇 시간 동안 검색했습니다. 어떤 힌트?

+0

이 보이는 :

내가 이렇게 내 코드를 수정 끝났다. 여전히 dotnet 클라이언트로 요청에 추가하는 방법을 알아 내려고합니다. –

답변

0

문제가 실제로 customerClientID를 전달해야하는 것으로 보입니다.

This document 내가 무슨 일이 있었는지 그림을 도왔습니다. 이 요청에 customerClientID를 지정하지 않는 관련이있을 수 있습니다처럼

var configOptions = new Dictionary<string,string>(); 
configOptions.Add("clientCustomerID", customerID.ToString()); 
_handler.RunReport(new AdWordsUser(configOptions), definition); 
관련 문제