Getting this 
[RequiredError.REQUIRED @ operations[0].operand.status, 
AdError.CANNOT_USE_AD_SUBCLASS_FOR_OPERATOR @ operations[0].operand.ad] 

ublic static function runExample(AdWordsServices $adWordsServices,
    AdWordsSession $session, $adGroupId, $adId) {
  $adGroupAdService =
      $adWordsServices->get($session, AdGroupAdService::class);

  $operations = [];
  // Create ad using an existing ID. Use the base class Ad instead of TextAd
  // to avoid having to set ad-specific fields.
  $ad = new ExpandedTextAd();
  $ad->setId($adId);
    $ad->setDescription('dad');

  // Create ad group ad.
  $adGroupAd = new AdGroupAd();
  $adGroupAd->setAdGroupId($adGroupId);
  $adGroupAd->setAd($ad);


  // Create ad group ad operation and add it to the list.
  $operation = new AdGroupAdOperation();
  $operation->setOperand($adGroupAd);
  $operation->setOperator(Operator::SET);
  $operations[] = $operation;

  // Remove the ad on the server.
  $result = $adGroupAdService->mutate($operations);

  $adGroupAd = $result->getValue()[0];
  printf("Ad with ID %d was removed.\n", $adGroupAd->getAd()->getId());
}



On Friday, March 10, 2017 at 9:55:47 AM UTC-6, Dan Hai wrote:
>
> Can I make changes to Ads in a AdGroup, if so how?
>
> Would I need to create an operation method and create a new Ad operation?
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/77dd152d-aac9-403b-b8f2-1181fd4e1c88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to