Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Damion 85 posts 319 karma points
    Apr 17, 2019 @ 15:52

    Create user groups and assign users in code

    In v8 is it possible to create user groups and assign users to those groups, the way we can with members and roles using the IMemberService?

    I had a look at the IUserService and can create users just fine but not groups or assignations.

    Is this in another service or is it not possible?


  • Marc Goodson 1158 posts 7724 karma points MVP 5x c-trib
    Apr 27, 2019 @ 11:24
    Marc Goodson

    Hi Damion

    I think it is! there is an overload of the Save method of the UserService that accepts a UserGroup object, and an array of ids corresponding to Users to add...

    I am gleaning this by looking at the source for the code here:

    but I think something like this could work...

    UserGroup SuperAdmins = new UserGroup() { Alias = "superAdmins", Name="Super Admin" };
        userService.Save(SuperAdmins, new int[] { 123, 124 });



  • Damion 85 posts 319 karma points
    Apr 29, 2019 @ 09:10

    Hi Marc,

    thanks for the reply, I'll give this a go and mark as accepted as soon as


Please Sign in or register to post replies

Write your reply to: