Copied to clipboard

Flag this post as spam?

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


  • Robin Larsson 6 posts 87 karma points
    Jan 22, 2019 @ 10:15
    Robin Larsson
    0

    Get all users in a group

    Hello,

    I have a simple question but I haven't figured out where to find the right place to look for getting all users in a specific group. While i can find all groups but not filter on anything based on a User object. In this case I am not trying to use anything from the Member object which i know there are a lot of questions and docummentation about :).

    I could just find something like UserCount from a group but not the users themselves. enter image description here

    What I want to do is find all groups associated with a user. Perhaps there's another solution to this.

  • Rhys Hamilton 140 posts 942 karma points
    Jan 22, 2019 @ 11:40
    Rhys Hamilton
    0

    You can find the groups associated with the user, like so:

    var users = Services.UserService.GetAll();
    
    foreach (var user in users)
    {
       // Get all groups associated with the user
        var groups = user.Groups; 
    
        // TO DO ??
    }
    

    Hopefully this is what you're after.

  • Robin Larsson 6 posts 87 karma points
    Jan 22, 2019 @ 12:19
    Robin Larsson
    1

    Thank you very much! I now noticed how I could use the User Object and get the Groups property as you displayed above. GetAll is a paginated response which need additional logic and a few parameters to get users certain user.

    This was my solution since I only need one user and could example get it by his/her email. enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft