/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="businessId">The AdWords Express business id.</param> public void Run(AdWordsUser user, long businessId) { // Get the ExpressBusinessService. ExpressBusinessService businessService = (ExpressBusinessService) user.GetService(AdWordsService.v201601.ExpressBusinessService); // Update the website and address for the business ExpressBusiness business = new ExpressBusiness(); business.id = businessId; business.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); business.website = "http://www.example.com/?myParam=" + businessId; ExpressBusinessOperation operation = new ExpressBusinessOperation(); operation.@operator = Operator.SET; operation.operand = business; try { ExpressBusiness[] updatedBusinesses = businessService.mutate(new ExpressBusinessOperation[] { operation }); Console.WriteLine("Express business with ID {0} and name '{1}' was updated.", updatedBusinesses[0].id, updatedBusinesses[0].name); } catch (Exception e) { throw new System.ApplicationException("Failed to update express business.", e); } }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { // Get the ExpressBusinessService. ExpressBusinessService businessService = (ExpressBusinessService) user.GetService(AdWordsService.v201502.ExpressBusinessService); ExpressBusiness business1 = new ExpressBusiness(); business1.status = ExpressBusinessStatus.ENABLED; business1.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); Address address1 = new Address(); address1.streetAddress = "1600 Amphitheatre Pkwy"; address1.cityName = "Mountain View"; address1.provinceCode = "CA"; address1.countryCode = "US"; business1.address = address1; business1.website = "http://www.example.com/cruise1"; ExpressBusinessOperation operation1 = new ExpressBusinessOperation(); operation1.@operator = Operator.ADD; operation1.operand = business1; ExpressBusiness business2 = new ExpressBusiness(); business2.status = (ExpressBusinessStatus.ENABLED); business2.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); Address address2 = new Address(); address2.streetAddress = "111 8th Ave"; address2.cityName = "New York"; address2.provinceCode = "NY"; address2.countryCode = "US"; business2.address = address2; business2.website = "http://www.example.com/cruise2"; ExpressBusinessOperation operation2 = new ExpressBusinessOperation(); operation2.@operator = Operator.ADD; operation2.operand = business2; try { ExpressBusiness[] addedBusinesses = businessService.mutate( new ExpressBusinessOperation[] { operation1, operation2 }); Console.WriteLine("Added {0} express businesses", addedBusinesses.Length); foreach (ExpressBusiness addedBusiness in addedBusinesses) { Console.WriteLine("Added express business with ID = {0} and name '{1}'.", addedBusiness.id, addedBusiness.name); } } catch (Exception ex) { throw new System.ApplicationException("Failed to add express business.", ex); } }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="businessId">The AdWords Express business id.</param> public void Run(AdWordsUser user, long businessId) { // Get the ExpressBusinessService. ExpressBusinessService businessService = (ExpressBusinessService) user.GetService(AdWordsService.v201601.ExpressBusinessService); // Update the website and address for the business ExpressBusiness business = new ExpressBusiness(); business.id = businessId; business.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); business.website = "http://www.example.com/?myParam=" + businessId; ExpressBusinessOperation operation = new ExpressBusinessOperation(); operation.@operator = Operator.SET; operation.operand = business; try { ExpressBusiness[] updatedBusinesses = businessService.mutate(new ExpressBusinessOperation[] { operation }); Console.WriteLine("Express business with ID {0} and name '{1}' was updated.", updatedBusinesses[0].id, updatedBusinesses[0].name); } catch (Exception e) { throw new System.ApplicationException("Failed to update express business.", e); } }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { // Get the ExpressBusinessService. ExpressBusinessService businessService = (ExpressBusinessService) user.GetService(AdWordsService.v201509.ExpressBusinessService); ExpressBusiness business1 = new ExpressBusiness(); business1.status = ExpressBusinessStatus.ENABLED; business1.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); Address address1 = new Address(); address1.streetAddress = "1600 Amphitheatre Pkwy"; address1.cityName = "Mountain View"; address1.provinceCode = "CA"; address1.countryCode = "US"; business1.address = address1; business1.website = "http://www.example.com/cruise1"; ExpressBusinessOperation operation1 = new ExpressBusinessOperation(); operation1.@operator = Operator.ADD; operation1.operand = business1; ExpressBusiness business2 = new ExpressBusiness(); business2.status = (ExpressBusinessStatus.ENABLED); business2.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); Address address2 = new Address(); address2.streetAddress = "111 8th Ave"; address2.cityName = "New York"; address2.provinceCode = "NY"; address2.countryCode = "US"; business2.address = address2; business2.website = "http://www.example.com/cruise2"; ExpressBusinessOperation operation2 = new ExpressBusinessOperation(); operation2.@operator = Operator.ADD; operation2.operand = business2; try { ExpressBusiness[] addedBusinesses = businessService.mutate( new ExpressBusinessOperation[] {operation1, operation2}); Console.WriteLine("Added {0} express businesses", addedBusinesses.Length); foreach (ExpressBusiness addedBusiness in addedBusinesses) { Console.WriteLine("Added express business with ID = {0} and name '{1}'.", addedBusiness.id, addedBusiness.name); } } catch (Exception e) { throw new System.ApplicationException("Failed to add express business.", e); } }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { // Get the ExpressBusinessService. ExpressBusinessService businessService = (ExpressBusinessService) user.GetService(AdWordsService.v201605.ExpressBusinessService); ExpressBusiness business1 = new ExpressBusiness(); business1.status = ExpressBusinessStatus.ENABLED; business1.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); business1.website = "http://www.example.com/cruise1"; ExpressBusinessOperation operation1 = new ExpressBusinessOperation(); operation1.@operator = Operator.ADD; operation1.operand = business1; ExpressBusiness business2 = new ExpressBusiness(); business2.status = (ExpressBusinessStatus.ENABLED); business2.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); business2.website = "http://www.example.com/cruise2"; ExpressBusinessOperation operation2 = new ExpressBusinessOperation(); operation2.@operator = Operator.ADD; operation2.operand = business2; try { ExpressBusiness[] addedBusinesses = businessService.mutate( new ExpressBusinessOperation[] { operation1, operation2 }); Console.WriteLine("Added {0} express businesses", addedBusinesses.Length); foreach (ExpressBusiness addedBusiness in addedBusinesses) { Console.WriteLine("Added express business with ID = {0} and name '{1}'.", addedBusiness.id, addedBusiness.name); } } catch (Exception e) { throw new System.ApplicationException("Failed to add express business.", e); } }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { // Get the ExpressBusinessService. ExpressBusinessService businessService = (ExpressBusinessService) user.GetService(AdWordsService.v201601.ExpressBusinessService); ExpressBusiness business1 = new ExpressBusiness(); business1.status = ExpressBusinessStatus.ENABLED; business1.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); business1.website = "http://www.example.com/cruise1"; ExpressBusinessOperation operation1 = new ExpressBusinessOperation(); operation1.@operator = Operator.ADD; operation1.operand = business1; ExpressBusiness business2 = new ExpressBusiness(); business2.status = (ExpressBusinessStatus.ENABLED); business2.name = "Express Interplanetary Cruise #" + ExampleUtilities.GetShortRandomString(); business2.website = "http://www.example.com/cruise2"; ExpressBusinessOperation operation2 = new ExpressBusinessOperation(); operation2.@operator = Operator.ADD; operation2.operand = business2; try { ExpressBusiness[] addedBusinesses = businessService.mutate( new ExpressBusinessOperation[] {operation1, operation2}); Console.WriteLine("Added {0} express businesses", addedBusinesses.Length); foreach (ExpressBusiness addedBusiness in addedBusinesses) { Console.WriteLine("Added express business with ID = {0} and name '{1}'.", addedBusiness.id, addedBusiness.name); } } catch (Exception e) { throw new System.ApplicationException("Failed to add express business.", e); } }