/// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="service">An authenticated AdExchangeBuyerIIService</param>
        public override void Run(BaseClientService service)
        {
            AdExchangeBuyerIIService adXService = (AdExchangeBuyerIIService)service;

            long accountId       = long.Parse("INSERT ACCOUNT ID HERE");
            long clientAccountId = long.Parse("INSERT CLIENT ACCOUNT ID HERE");

            ClientUserInvitation invite = new ClientUserInvitation
            {
                Email = "INSERT EMAIL ADDRESS HERE"
            };

            ClientUserInvitation responseInvite = adXService.Accounts.Clients.Invitations.Create(
                invite, accountId, clientAccountId).Execute();

            Console.WriteLine("Created and sent new invitation for account ID \"{0}\" and client " +
                              "account ID \"{1}\" to \"{2}\".", accountId, responseInvite.ClientAccountId,
                              invite.Email);
        }
예제 #2
0
        /// <param name="body">A valid AdExchangeBuyerII v2beta1 body.</param>
        /// <returns>ClientUserInvitationResponse</returns>
        public static ClientUserInvitation Create(AdExchangeBuyerIIService service, string accountId, string clientAccountId, ClientUserInvitation body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (clientAccountId == null)
                {
                    throw new ArgumentNullException(clientAccountId);
                }

                // Make the request.
                return(service.Invitations.Create(body, accountId, clientAccountId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Invitations.Create failed.", ex);
            }
        }