Hi there,
I've seen in the backend that i can sort users in groups, how do i implement this in the API (C#)? Lets imagine i have a UserMangement.Group, with some UserManagement.User objects, how do i sort these in the group?
Best,
Jonas
Hi there,
I've seen in the backend that i can sort users in groups, how do i implement this in the API (C#)? Lets imagine i have a UserMangement.Group, with some UserManagement.User objects, how do i sort these in the group?
Best,
Jonas
The code that runs in user management UI is this:
string[] userids = Strings.Split(Dynamicweb.Context.Current.Request("Users"), ",");
for (int i = 0; i <= userids.Length - 1; i++) {
User user = user.GetUserByID(Convert.ToInt32(userids(i)));
user.UserSortCollection.AddOrReplace(new UserSort(GroupID, i));
user.Save();
}
Hi Nicolai,
I got em' sorted now; but nomatter what API call i use to fetch the users in the group ( Group.Users / UserManagement.User.GetUsersByGroupID ) they are not sorted as specified?
Best
Jonas
Hi Jonas
If you load the users in a usercollection and call SortBy(SortFields.Sorting, True, userGroup), you get the users sorted.
Remember a user can have multiple groups, so they are sorted relative to a group and the user can have different sorting value depending on the group
You must be logged in to post in the forum