Hallo,

i hope this question wasn't answered yet if yes i'm sorry to ask again.

So I'm trying to pu a new label to an AdGroup and i found one solution 
using the AdGroupLabelOperation[] and ReturnValue but it doesn't work and i 
get always an EntityNotFound.INVALID_ID Error.

I dont' know if what i'm doing is wrong or right. And my next question 
would be: Why can't i add a name to the label the is 
only AdGroupLabel.setId no setName, how could i add a name. 

Thanks a lot for reading this. 

AdGroupServiceInterface adGroupService = adWordsServices.get(session, 
AdGroupServiceInterface.class);
AdGroupLabel label1 = new AdGroupLabel();
label1.setAdGroupId(Long.parseLong(adGroupId));
label1.setLabelId((long) 1001020);
AdGroupLabelOperation operation1 = new AdGroupLabelOperation();
operation1.setOperand(label1);
operation1.setOperator(Operator.ADD);
AdGroupLabelOperation[] operations1 = new AdGroupLabelOperation[] 
{operation1};
// Create ad group with updated status.
AdGroup adGroup = new AdGroup();
adGroup.setId(Long.parseLong(adGroupId));
adGroup.setStatus(AdGroupStatus.PAUSED);
adGroup.setLabels(labelArray);

// Create operations.
AdGroupOperation operation = new AdGroupOperation();
operation.setOperand(adGroup);
operation.setOperator(Operator.SET);
AdGroupOperation[] operations = new AdGroupOperation[] { operation};
// Update ad group.
try {
AdGroupReturnValue result = adGroupService.mutate(operations);
AdGroupLabelReturnValue result1 = adGroupService.mutateLabel(operations1);
} catch (ApiException e) {
System.out.println("Error while updating Status with ApiException : " + e);
} catch (RemoteException e) {
System.out.println("Error while updating Status with RemoteException : " + 
e);
}


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
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/ab409717-72bd-44b0-b9d8-df3fcad3bad3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to