Hi there,

I am trying to convert some code from v13 to v201109_1 Adwords API. I have 
spent hours looking around and cannot find any examples of this.
Any help would be much appreciated!!! Thank you. The old code is the 
following:

UserStatus[] userStatus = new UserStatus[] { UserStatus.ACTIVE, 
UserStatus.PAUSED, UserStatus.DELETED };

//biddable keywords
GAPIKeywords keywords = new GAPIKeywords(m_user, 
AdGroupCriterionTypeEnum.BIDDABLE);
keywords.PopulateAllKeywordTypesByCampaign(campaignId, userStatus);

I did not write this code but need to update it and have tried (failed) 
with the below:

// Get the AdGroupCriterionService.
AdGroupCriterionService adGroupCriterionService =
    
 
(AdGroupCriterionService)_user.GetService(AdWordsService.v201109_1.AdGroupCriterionService);

// Create the filters.
Predicate campaignIdsPredicate = new Predicate();
campaignIdsPredicate.field = "CampaignId";
campaignIdsPredicate.@operator = PredicateOperator.IN;
campaignIdsPredicate.values = campaignId;

// Select only keywords.
Predicate predicateCT = new Predicate();
predicateCT.field = "CriteriaType";
predicateCT.@operator = PredicateOperator.IN;
predicateCT.values = new string[] { "KEYWORD", "BIDDABLE" };

// Filter on user status.
Predicate predicateUS = new Predicate();
predicateUS.field = "UserStatus";
predicateUS.@operator = PredicateOperator.IN;
predicateUS.values = new string[] { UserStatus.ACTIVE.ToString(), 
UserStatus.PAUSED.ToString(), UserStatus.DELETED.ToString() };

// Create a selector.
Selector selector = new Selector();
selector.fields = new string[] { "Id", "AdGroupId", "KeywordText" };
selector.predicates = new Predicate[] { campaignIdsPredicate, predicateCT, 
predicateUS };

AdGroupCriterionPage page = adGroupCriterionService.get(selector);

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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