/// <summary>Snippet for MutateAds</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateAds() { // Create client AdServiceClient adServiceClient = AdServiceClient.Create(); // Initialize request argument(s) string customerId = ""; IEnumerable <AdOperation> operations = new AdOperation[] { new AdOperation(), }; // Make the request MutateAdsResponse response = adServiceClient.MutateAds(customerId, operations); }
/// <summary>Snippet for MutateAds</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateAdsRequestObject() { // Create client AdServiceClient adServiceClient = AdServiceClient.Create(); // Initialize request argument(s) MutateAdsRequest request = new MutateAdsRequest { CustomerId = "", Operations = { new AdOperation(), }, }; // Make the request MutateAdsResponse response = adServiceClient.MutateAds(request); }
/// <summary>Snippet for MutateAds</summary> public void MutateAdsRequestObject() { // Snippet: MutateAds(MutateAdsRequest, CallSettings) // Create client AdServiceClient adServiceClient = AdServiceClient.Create(); // Initialize request argument(s) MutateAdsRequest request = new MutateAdsRequest { CustomerId = "", Operations = { new AdOperation(), }, ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified, }; // Make the request MutateAdsResponse response = adServiceClient.MutateAds(request); // End snippet }
/// <summary>Snippet for MutateAds</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateAdsRequestObject() { // Create client AdServiceClient adServiceClient = AdServiceClient.Create(); // Initialize request argument(s) MutateAdsRequest request = new MutateAdsRequest { CustomerId = "", Operations = { new AdOperation(), }, ValidateOnly = false, PartialFailure = false, ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified, }; // Make the request MutateAdsResponse response = adServiceClient.MutateAds(request); }
/// <summary> /// Runs the code example. /// </summary> /// <param name="client">The Google Ads client.</param> /// <param name="customerId">The Google Ads customer ID for which the call is made.</param> /// <param name="adId"> ID of the ad to update.</param> // [START update_expanded_text_ad] public void Run(GoogleAdsClient client, long customerId, long adId) { // Get the AdService. AdServiceClient adService = client.GetService(Services.V10.AdService); Ad ad = new Ad() { ResourceName = ResourceNames.Ad(customerId, adId), ExpandedTextAd = new ExpandedTextAdInfo() { // Update some properties of the expanded text ad. HeadlinePart1 = "Cruise to Pluto #" + ExampleUtilities.GetShortRandomString(), HeadlinePart2 = "Tickets on sale now", Description = "Best space cruise ever.", }, FinalUrls = { "http://www.example.com/" }, FinalMobileUrls = { "http://www.example.com/mobile" } }; AdOperation operation = new AdOperation() { Update = ad, UpdateMask = FieldMasks.AllSetFieldsOf(ad) }; try { // Issue the update request. MutateAdsResponse response = adService.MutateAds(customerId.ToString(), new[] { operation }); // Display the results. foreach (MutateAdResult updatedAd in response.Results) { Console.WriteLine($"Ad with resource ID = '{updatedAd.ResourceName}' was " + $"updated."); } } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; } }