public void Run(AdWordsUser user)
{
// Get the ManagedCustomerService.
ManagedCustomerService managedCustomerService = (ManagedCustomerService) user.GetService(
AdWordsService.v201306.ManagedCustomerService);
// Create account.
ManagedCustomer customer = new ManagedCustomer();
customer.name = "Customer created with ManagedCustomerService on " +
new DateTime().ToString();
customer.currencyCode = "EUR";
customer.dateTimeZone = "Europe/London";
// Create operations.
ManagedCustomerOperation operation = new ManagedCustomerOperation();
operation.operand = customer;
operation.@operator = Operator.ADD;
try {
ManagedCustomerOperation[] operations = new ManagedCustomerOperation[] {operation};
// Add account.
ManagedCustomerReturnValue result = managedCustomerService.mutate(operations);
// Display accounts.
if (result.value != null && result.value.Length > 0) {
ManagedCustomer customerResult = result.value[0];
Console.WriteLine("Account with customer ID \"{0}\" was created.",
customerResult.customerId);
} else {
Console.WriteLine("No accounts were created.");
}
} catch (Exception ex) {
throw new System.ApplicationException("Failed to create accounts.", ex);
}
}