05-11-2018 07:04 AM
Hello,
I have a string variable in script which contains username.
I need to check if this user is exists in OnBase. If not then create that user and add that in specific user group. I am not sure how to accomplish that.
Here a code not sure if it is a correct approach .
string tryuser="ABCD";
Hyland.Unity.User user=app.Core.GetUser(tryuser); //check if user is in OnBase
if(user==null)
{
//Create a new user and add that user in Usergroup1
}
Thanks!
05-11-2018 04:46 PM
Hi Pallavi,
Instead of using app.Core.GetUser() method, I recommend UserAdministration.GetUsers() method to get a UserList object, and from this list object, find the specific User object you are looking for. The GetUsers() method can also take in a UserGroup object as a parameter, so you only get a list of users from that specific usergroup.
And the UserAdministration class has the functionality of creating new users and adding them to usergroups as well.
05-18-2018 05:17 AM
11-02-2018 03:31 AM
Its quite easy and you can do a number of things when creating new users.
UserAdministration UserAdmin = app.Core.UserAdministration;
NewUserProperties properties = UserAdmin.CreateNewUserProperties("USERNAME", "PASSWORD");
properties.RealName = "REAL_NAME";
properties.EmailAddress = "EMAIL_ADDRESS";
UserGroup primaryUserGroup = UserAdmin.GetUserGroups().Find(1);
properties.PrimaryUserGroup = primaryUserGroup;
List<UserGroup> userGroupList = new List<UserGroup>();
userGroupList.Add(UserAdmin.GetUserGroups().Find(2));
userGroupList.Add(UserAdmin.GetUserGroups().Find(3));
properties.AssignNamedClientLicense = false;
properties.AssignNamedWorkflowLicense = false;
properties.AssignNamedWorkviewLicense = false;
properties.TemplateUser = UserAdmin.GetUsers().Find(2);
properties.AutoDisplayNum = 2;
properties.ThrowExceptionOnNamedLicenseNotAvailable = true;
User user = UserAdmin.CreateUser(properties);
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.