Hi

I would like to DISABLE all my ads. My code is very simple:

var selector = new Selector
{
    fields = new string[] { 
        Google.Api.Ads.AdWords.v201607.AdGroupAd.Fields.AdGroupId, 
        Google.Api.Ads.AdWords.v201607.AdGroupAd.Fields.Labels, 
        Google.Api.Ads.AdWords.v201607.AdGroupAd.Fields.Status 
    }
};

var page = adGroupAdService.get(selector);
foreach (var adGroupAd in page.entries.ToList())
{
    var operation = new AdGroupAdOperation
    {
        @operator = Operator.SET,
        operand = adGroupAd
    };

    adGroupAd.status = AdGroupAdStatus.PAUSED;
    adGroupAdService.mutate(new AdGroupAdOperation[] { operation })   
}

I get the exception:
This operator cannot be used with a subclass of Ad.. (Error: 
AdError.CANNOT_USE_AD_SUBCLASS_FOR_OPERATOR, FieldPath: 
operations[0].operand.ad, Trigger: )

Any help would be highly appreciated.

Kind regards
Mikkel

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/754695b8-c0b0-457c-b749-760283d18b3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Error when upda... Mikkel Mortensen
    • Re: Error ... 'Shwetha Vastrad (AdWords API Team)' via AdWords API Forum

Reply via email to