GetEnterpriseUsersAsync - Service Account User types and external users
deleepgeorge opened this issue · comments
- I have checked that the SDK documentation doesn't solve my issue.
- I have checked that the API documentation doesn't solve my issue.
- I have searched the Box Developer Forums and my issue isn't already reported (or if it has been reported, I have attached a link to it, for reference).
- I have searched Issues in this repo and my issue isn't already reported.
Description of the Issue
GetEnterpriseUsersAsync(..) doesn't seem to return the service account user types. How do I get a list of service accounts ? Additionally the way GetEnterpriseUsersAsync(..) returns external users is not intuitive at all, it requires the exact external user email address in the filterTerm. Is there a way to list all external users?
Steps to Reproduce
internal void GetAllUsers()
{
var boxConfig = BoxConfig.CreateFromJsonFile(new System.IO.StreamReader("BoxConfig_FileName_here").BaseStream);
var boxJWT = new BoxJWTAuth(boxConfig);
var adminToken = boxJWT.AdminToken();
var adminClient = boxJWT.AdminClient(adminToken);
/* external user - need to pass the exact login to return external user */
var externaluser = await adminClient.UsersManager.GetEnterpriseUsersAsync(filterTerm: "external_user@somedomain.com", userType: "all", offset: 0, limit: 100);
/* all users - doesn't seem to return service account user types but it does return all the app users created by the service account */
var allusers = await adminClient.UsersManager.GetEnterpriseUsersAsync(userType: "all", offset: 0, limit: 100);
}
Expected Behavior
GetEnterpriseUsersAsync() should return Service account user type as well.
GetEnterpriseUsersAsync() returns all external users without passing a filter.
Error Message, Including Stack Trace
None
Screenshots
Versions Used
.Net SDK: 3.24.0
Windows: Windows 10 (2004) 64 bit
- The API for getting an external user https://developer.box.com/reference/get-users/ only returns an external user if the login in the filter term is an exact match. It can't currently return all external users. Sorry for the inconvenience.
- The service account is technically not a user. It is more of an account for an app, so it is not returned.
If you have any follow-up questions, feel free to re-open this issue.
- The API for getting an external user https://developer.box.com/reference/get-users/ only returns an external user if the login in the filter term is an exact match. It can't currently return all external users. Sorry for the inconvenience.
- The service account is technically not a user. It is more of an account for an app, so it is not returned.
If you have any follow-up questions, feel free to re-open this issue.
@sujaygarlanka, Thanks for the response.. I am trying to get a list of all the users (managed/app/service account/external) for reporting purpose. Is there a way / workaround to get all the external users ?
Also GetEnterpriseUsersAsync() does return the App users but there is no way to identify which service account created the App users. Is it possible to get that information by any means ?
@deleepgeorge Sorry, there currently isn't a way around getting all the external users. Regarding your second question, the app users you get from the call will be the ones associated with the token you use, which is tied to an app and service account. Maybe I am misunderstanding your question, but the app users that are returned will be created by the service account associated with your token.