Here is my code ( i just barely modified it) -
//Campaign operation
CampaignCriterionServiceInterface campaignCriterionService =
adWordsServices.get(session, CampaignCriterionServiceInterface.
class);
long campId = Long.parseLong(campaignId);
CriterionUserList userList_Camp = new CriterionUserList();
userList_Camp.setUserListId(userListId);
CampaignCriterion criterion = new CampaignCriterion();
criterion.setCampaignId(campId);
criterion.setCriterion(userList_Camp);
CampaignCriterionOperation operation_camp = new
CampaignCriterionOperation();
operation.setOperand(criterion);
operation.setOperator(Operator.ADD);
CampaignCriterionOperation[] operations = new CampaignCriterionOperation
[] {operation_camp};
CampaignCriterionReturnValue result_camp = campaignCriterionService.
mutate(operations);
However I am getting the error -
The method setCriterion(Criterion) in the type CampaignCriterion is not
applicable for the arguments (CriterionUserList)
The method setOperand(UserList) in the type UserListOperation is not
applicable for the arguments (CampaignCriterion)
I can't seem to pass the userList to criterion
On Wednesday, March 15, 2017 at 12:45:50 PM UTC-7, Shwetha Vastrad (AdWords
API Team) wrote:
>
> Hi,
>
> Please use the code snippet provided below to add a UserList to a campaign.
>
> CriterionUserList userList = new CriterionUserList();
> userList.setUserListId(userListId);
>
> CampaignCriterion criterion = new CampaignCriterion();
> criterion.setCampaignId(campaignId);
> criterion.setCriterion(userList);
>
> CampaignCriterionOperation operation = new CampaignCriterionOperation();
> operation.setOperand(criterion);
> operation.setOperator(Operator.ADD);
>
> CampaignCriterionOperation[] operations = new CampaignCriterionOperation[]
> {operation};
> CampaignCriterionReturnValue result = campaignCriterionService.mutate(
> operations);
>
> You can also set other options when you add the CampaignCriterion
> <https://developers.google.com/adwords/api/docs/reference/v201702/CampaignCriterionService.CampaignCriterion>
> .
>
> Regards,
> Shwetha, AdWords API Team.
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/1eeee5bc-8b27-48e7-8e37-7f43a2ddd11a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.