// Gets the DataService
DataService dataService = (DataService)user.GetService(AdWordsService.v201306.DataService);
// Creates the selector.
Selector selector = new Selector();
selector.fields = new string[] { "CampaignId", "StartDate", "EndDate", "LocalImpressions", "LocalClicks", "LocalCost", "Bid", "MarginalCpc" };
// Creates the predicate to filter the bid lanscapes for the selected keywords
Predicate criterionPredicate = new Predicate();
criterionPredicate.field = "CriterionId";
criterionPredicate.@operator = PredicateOperator.IN;
criterionPredicate.values = adGroupCriterionPage.entries.Select(k => k.criterion.id.ToString()).ToArray();
selector.predicates = new Predicate[] { adGroupPredicate, criterionPredicate };
// Creates paging controls
selector.paging = new Paging();
selector.paging.startIndex = 0;
selector.paging.numberResults = 10000;
CriterionBidLandscapePage criterionBidLandscapePage = null;
do
{
try
{
// Gets bid landscapes for the selected keywords
criterionBidLandscapePage = dataService.getCriterionBidLandscape(selector);
// Use criterionBidLandscapePage entries data
}
catch (Exception ex)
{
// Handle Error
}
selector.paging.startIndex += 10000;
}
while (criterionBidLandscapePage.totalNumEntries > selector.paging.startIndex);