Viewing previous posts on this topic, I've decided it would be easier just 
to delete my partition tree and create a new one. However, I get an error 
when I try. I've created operations of type REMOVE in the 
ProductPartitionHelper.cs class like so (very similar to the ...

        public void CreateRemoveOperation(AdGroupCriterion criterion)
        {
            criterion.adGroupId = this.adGroupId;
            AdGroupCriterionOperation operation = new 
AdGroupCriterionOperation();
            operation.operand = criterion;
            operation.@operator = Operator.REMOVE;
            this.operations.Add(operation);
        }

Then I get all the Partitions in the adGroup. There are 3 of them in my 
case: the default partition (type SUBDIVISION), the partition I want to bid 
on (type UNIT), and the "everything else" partition (also type UNIT). Then 
I loop through them to create delete operations using the 
ProductPartitionHelper, followed by the mutate operation, like so...

            List<AdGroupCriterion> list = 
GetCriteriaForShoppingAdGroup(adGroupID);
            Debug.WriteLine(list.Count);
            ProductPartitionHelper helper = new 
ProductPartitionHelper(adGroupID); 
            foreach (AdGroupCriterion cri in list)
            {               
                helper.CreateRemoveOperation(cri);
            }           

            AdGroupCriterionService adGroupCriterionService =
                (AdGroupCriterionService)user.GetService(
                AdWordsService.v201406.AdGroupCriterionService);
            try
            {
                adGroupCriterionService.mutate(helper.Operations);
            }            
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                if (ex.InnerException != null)
                {
                    Debug.WriteLine("Inner Exception:" + 
ex.InnerException.Message);                    
                }
            }

...it chokes on the mutate method with this: Inner 
Exception:[AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
operations[1].operand.criterion.id, 
AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
operations[2].operand.criterion.id]

the third partition in this tree, the "everything else" partition, (the one 
represented by operations[2]) is excluded, hence the Google API gave it a 
type of NegativeAdGroupCriterion (criterionUse = "NEGATIVE"). 

So, since it thinks this partition doesn't exist, I tried passing only the 
first two, omitting the 3rd. When I do that, I get the same error:
Inner Exception:[AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
operations[1].operand.criterion.id]

...that operation is represented by the real product I'm bidding on, and it 
most assuredly does exist. I can verify this by downloading the report from 
the UI for the adGroup and comparing criterion ID's. It's definitely a 
product partition with a criterion type of BIDDABLE.

Finally, I tried removing just the root partition. I had seen earlier Josh 
indicated that removing that partition performs a cascading delete. 
However, when I do that, I get this exception: 
Inner 
Exception:[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE 
@ operations[0].operand.userStatus; trigger:'SHOPPING', 
OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ 
operations[0].operand.biddingStrategyConfiguration.biddingScheme; 
trigger:'SHOPPING', 
OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ 
operations[0].operand.biddingStrategyConfiguration.biddingStrategyType; 
trigger:'SHOPPING']


 So, can somebody from the adwords team set me straight? How do you delete 
a partition tree out of an adGroup through the API that contains an 
excluded partition (all of ours do)? It doesn't seem to like anything I 
throw at it.

Eric


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to