Importing user settings
For installations with a large number of users it can be a tedious task to manually define the user settings (in the menu "My Settings"). You can use Java APIs to migrate user settings from one system to another system.
Procedure
- Develop a Java API based extension point (for example, a Scripting Sandbox extension point), custom JSP or a WebService.
- Retrieve the user settings from the source system using getUserSettingValue() Java API.
- Set the values to the target system using the Java API setUserSettingValue().
Example
Context context = PIMContextFactory.getCurrentContext();
OrganizationManager manager = context.getOrganizationManager();
User user = manager.getUser("User1");
for (UserSetting setting : UserSetting.values()) {
System.out.println("User Setting value: ", user.getUserSettingValue(setting));
}
The following code is an example of the usage of
setUserSettingValue() API, which sets the User Settings values for User
"User1":
Context context = PIMContextFactory.getCurrentContext();
OrganizationManager manager = context.getOrganizationManager();
User user = manager.getUser("User1");
user.setUserSettingValue(UserSetting.LOCALE, "fr_FR");
user.setUserSettingValue(UserSetting.DATETIMEOUTPUTFORMAT, "M/d/yy h:mm a");
user.save();