If I have a list of user types (both ID and name), how can I get the users that belong to that user type (not members)? There doesn't seem to be any methods for User[] userList = User.Get ByType
Thanks for the reply. Looks good but I must be missing something. I'm getting this:
'umbraco.BusinessLogic.User[]' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'umbraco.BusinessLogic.User[]' could be found (are you missing a using directive or an assembly reference?)
Strange, what version of Umbraco are you using? Just tested the following code and seems to be working fine:
var userType = UserType.GetUserType(2); var users = umbraco.BusinessLogic.User.getAll().Where(u => u.UserType == userType); foreach (var user in users) { <p>@user.Name</p> }
Umbraco Get Users by User Type
If I have a list of user types (both ID and name), how can I get the users that belong to that user type (not members)? There doesn't seem to be any methods for
User[] userList = User.Get ByType
Hi Chris,
How about something like this?
-Tom
Hey Tom,
Thanks for the reply. Looks good but I must be missing something. I'm getting this:
I am including umbraco.BusinessLogic. Any ideas?
Hi Chris,
You'll need a reference to the Linq namespace to be abe to use the Where() extension method:
HTH,
Hendy
Strange, what version of Umbraco are you using? Just tested the following code and seems to be working fine:
-Tom
Umbraco 4.8, but it's a custom control, not using Razor. Thanks a bunch, can't believe I missed that!
is working on a reply...