Skip to content

Latest commit

 

History

History
128 lines (90 loc) · 4.83 KB

users.md

File metadata and controls

128 lines (90 loc) · 4.83 KB

Users

Users represent an individual's account on Box.

Get the Current User's Information

To get the current user, call the static [getCurrentUser(BoxAPIConnection)] get-current-user method. Then use getInfo() to get information about the user.

BoxUser user = BoxUser.getCurrentUser(api);
BoxUser.Info info = user.getInfo();

Create An Enterprise User

To create an enterprise user call the createEnterpriseUser(BoxAPIConnection, String, String) or createEnterpriseUser(BoxAPIConnection, String, String, CreateUserParams) method.

BoxUser.Info createdUserInfo = BoxUser.createEnterpriseUser(api, "user@email.com", "A User");

Update User

To update a user call the updateInfo(BoxUser.Info) method.

BoxUser user = new BoxUser(api, "0");
BoxUser.Info info = user.new Info();
info.setName(name);
user.updateInfo(info);

Delete User

To delete a user call the delete(boolean, boolean) method.

BoxUser user = new BoxUser(api, "0");
user.delete(false, false);

Get Email Aliases

To get a users email aliases call the getEmailAliases() method.

BoxUser user = new BoxUser(api, "0");
Collection<EmailAlias> emailAliases = user.getEmailAliases();

Add Email Alias

To add an email alias for a user call the addEmailAlias(String) method.

BoxUser user = new BoxUser(api, "0");
user.addEmailAlias("user@email.com");

Delete Email Alias

To delete a users email alias call the deleteEmailAlias(String) method.

BoxUser user = new BoxUser(api, "0");
user.deleteEmailAlias("123");

Get Enterprise Users

To get an enterprises users call the getAllEnterpriseUsers(BoxAPIConnection), getAllEnterpriseUsers(BoxAPIConnection, String, String...), or getAllEnterpriseOrExternalUsers(BoxAPIConnection, String, String...) method.

Iterable<BoxUser.Info> users = BoxUser.getAllEnterpriseUsers(api);

Move User's Folder

To move a users folder call the moveFolderToUser(String) method. Currently, only moving the root folder (0) is supported.

BoxUser user = new BoxUser(api, "0");
BoxFolder.Info folderInfo = user.moveFolderToUser("1");