08-01-2024 11:30 AM
Hi,
I get all of the user groups with this: UserGroupList userGroups = app.Core.UserAdministration.GetUserGroups();, but then I need to get the users in a specific group in userGroups. I found this line: app.Core.UserAdministration.GetUsers(); and doing a foreach against userGroups, I can find my specific UserGroup. I then change the line to app.Core.UserAdministration.GetUsers(usergrp);, however I can't figure out what is on the left side to actually retrieve the users. I've found lots of examples on how to add someone to a user group, but not on getting the users in a user group via script.
Thank you.
08-01-2024 12:56 PM
For example, if you just wanted to loop over all the User Groups and write them out along with all the Users in each group you could use this:
foreach(UserGroup usrGrp in app.Core.UserAdministration.GetUserGroups()){ Console.WriteLine($"--{usrGrp.Name}"); foreach(User usr in app.Core.UserAdministration.GetUsers(usrGrp)) { Console.WriteLine($"----{usr.Name}"); }}
The Console.WriteLine obviously would only work in a Console app, not a script, but it illustrates using the User.
Not sure if that is what you were looking for.
If not, maybe you could describe what you are trying to do with the list of Users that are in the User Group once you get it?
08-01-2024 12:56 PM
For example, if you just wanted to loop over all the User Groups and write them out along with all the Users in each group you could use this:
foreach(UserGroup usrGrp in app.Core.UserAdministration.GetUserGroups()){ Console.WriteLine($"--{usrGrp.Name}"); foreach(User usr in app.Core.UserAdministration.GetUsers(usrGrp)) { Console.WriteLine($"----{usr.Name}"); }}
The Console.WriteLine obviously would only work in a Console app, not a script, but it illustrates using the User.
Not sure if that is what you were looking for.
If not, maybe you could describe what you are trying to do with the list of Users that are in the User Group once you get it?
08-01-2024 02:37 PM
Thank you! That was what I needed. Much appreciated!
08-02-2024 08:33 AM
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.