I am trying to PAUSE the Ads with the AdId and AdGroupID. I have successfully paused an AdGroup but i want to pause Ads individually. Is this possible on Adwords API. I tried the code below but It seems it only works on AdGroup level. Also checked the AdService but seems that there is no option to edit the Status. I am using Ads.AdWords.v201809 Thanks in advance

    public void googleEnableDisableAds(AdWordsUser user, long adGroupId, long AdID, AdGroupAdStatus AdStatus)     {         using (AdGroupAdService adGroupAdService =              (AdGroupAdService)user.GetService(AdWordsService.v201809.AdGroupAdService))         {             List<AdGroupAdOperation> operations = new List<AdGroupAdOperation>();             // Create the expanded text ad.             ExpandedTextAd expandedTextAd = new ExpandedTextAd             {                 //CR[i].                 id = AdID             };             AdGroupAd expandedTextAdGroupAd = new AdGroupAd             {                 adGroupId = adGroupId,                 ad = expandedTextAd,                 // Optional: Set the status.                 status = AdStatus             };             // Create the operation.             AdGroupAdOperation operation = new AdGroupAdOperation             {                 @operator = Operator.SET,                 operand = expandedTextAdGroupAd             };             operations.Add(operation);             AdGroupAdReturnValue retVal = null;             try             {                 if (operations.Count > 0)                 {                     // Create the ads.                     retVal = adGroupAdService.mutate(operations.ToArray());                     // Display the results.                     if (retVal != null && retVal.value != null)                     {                         foreach (AdGroupAd adGroupAd in retVal.value)                         {                             ExpandedTextAd newAd = adGroupAd.ad as ExpandedTextAd;                             Console.WriteLine(                                 "Expanded text ad with ID '{0}' and headline '{1} - {2}' " +                                 "was added.", newAd.id, newAd.headlinePart1, newAd.headlinePart2);                             //adGroupId                         }                     }                     else                     {                         Console.WriteLine("No expanded text ads were created.");                     }                 }                 adGroupAdService.Close();             }             catch (Exception e)             {                 throw new System.ApplicationException("Failed to create expanded text ad.", e);             }         }     } 

Tag:google-ads-api, c#

Only one comment.

  1. Дмитро Булах

    Here is an example from API docs https://developers.google.com/adwords/api/docs/samples/csharp/basic-operations#pause-an-ad

    The key idea is to set status property to PAUSED

    AdGroupAdStatus status = AdGroupAdStatus.PAUSED

Add a new comment.