https://developer.okta.com/okta-sdk-dotnet/latest/api/Okta.Sdk.IUsersClient.html#Okta_Sdk_IUsersClient_ListUserGroups_System_String_System_String_System_Nullable_System_Int32__
This link takes you to the Okta SDK IUsersClient method ListUserGroups. I have a user ID that I am passing into the method but I’m not sure what to do with what is being returned. Example:
ICollectionClient<IGroup> oktaGroups = client.Users.ListUserGroups(oktaUserId);
What do I do with oktaGroups after the method runs in order to get the names of the groups?
dragos
March 26, 2020, 2:23am
2
Hi @npaulson
You can use something like the following to list the group names.
var grps = client.Users.ListUserGroups("00uozbgc03wzqoaXp2p6").ToEnumerable();
foreach(var grp in grps)
{
Console.WriteLine(grp.Profile.Name);
}
Thanks for that, I haven’t used ToEnumerable before so I wasn’t sure what to do with it.
system
Closed
January 23, 2024, 10:59pm
4
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.