Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Roll Users Out of Enterprise #707

Closed
4 tasks done
g1t-out opened this issue Nov 2, 2020 · 3 comments
Closed
4 tasks done

Cannot Roll Users Out of Enterprise #707

g1t-out opened this issue Nov 2, 2020 · 3 comments
Assignees
Labels

Comments

@g1t-out
Copy link
Contributor

g1t-out commented Nov 2, 2020

Description of the Issue

I don't seem to be able to roll users out with the Box V2 .Net SDK SDK. If I take the same exact key and use it with the Python SDK, it seems to work fine. The Box V2 .Net SDK indicates it successfully updated the user but nothing changes. Even the Box Admin report indicate the user changed, but they are still in the enterprise. I went through and modified my request to have it change the user's name and that worked fine, but it didn't roll the user out still.

Steps to Reproduce

The code that is making the change is currently:

var updates = new BoxUserRequest()
{
    Id = boxId,
    Name = "Test Box Rollout",
    Enterprise = null
};
try
{
    //Rolling the user out
    BoxUser updatedUser = adminClient.UsersManager.UpdateUserInformationAsync(updates).GetAwaiter().GetResult();
}
catch (Exception Ex)
{
    Logger.LogError(methodName + ": Error rolling user out of enterprise " + Email + " Exception: " + Ex.Message.ToString());
}

Expected Behavior

It updated the user's name in Box, but did not roll them out. If we remove the Name from the BoxUserRequest, it will do nothing to the user's account at all.

Versions Used

.Net SDK: Box.V2 version 3.25.0. The application is targeting .Net Framework 4.6.1
Windows: Windows Server 2016 Version 1607

@sujaygarlanka
Copy link
Contributor

@jblack6-byu We are taking a look at this issue and will get back to you ASAP.

@g1t-out
Copy link
Contributor Author

g1t-out commented Nov 13, 2020

I've submitted a pull request to fix this issue: #709 . The problem occurs because the Serialize function under Box.V2.Converter.BoxJsonConverter is set to ignore null values. Thus we pass a null in and it ignores it and never puts it on the request. To get around this, I've created a separate UserRequestEntity class and am looking for that class in the BoxJsonConverter. If I see it, I don't pass the option to ignore nulls in the conversion to a JSON string.

My solution is probably not the most elegant as I'm not a great programmer nor am I well versed in C#. Hope this helps. Thanks!

@mwwoda
Copy link
Contributor

mwwoda commented Jan 10, 2022

Fixed via #792

@mwwoda mwwoda closed this as completed Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants