Box.V2.Managers.BoxUsersManager.ChangeUsersLoginAsync C# (CSharp) Method

ChangeUsersLoginAsync() public method

Used to convert one of the user’s confirmed email aliases into the user’s primary login.
public ChangeUsersLoginAsync ( string userId, string login, List fields = null ) : Task
userId string Id of the user.
login string The email alias to become the primary email.
fields List Attribute(s) to include in the response.
return Task
        public async Task<BoxUser> ChangeUsersLoginAsync(string userId, string login, List<string> fields = null)
        {
            userId.ThrowIfNullOrWhiteSpace("userId");
            login.ThrowIfNullOrWhiteSpace("login");

            BoxRequest request = new BoxRequest(_config.UserEndpointUri, userId)
            .Param(ParamFields, fields)
            .Payload(_converter.Serialize(new BoxUserRequest() { Login = login }))
            .Method(RequestMethod.Put);

            IBoxResponse<BoxUser> response = await ToResponseAsync<BoxUser>(request).ConfigureAwait(false);

            return response.ResponseObject;
        }