# Organizations.GetAllMembersAsync works but IList\<Role\> is always null

**URL:** <https://community.auth0.com/t/organizations-getallmembersasync-works-but-ilist-role-is-always-null/134843>\
**Category:** Get Help\
**Tags:** user-profile, user-management\
**Created:** [May 23, 2024, 1:33pm UTC](https://community.auth0.com/t/organizations-getallmembersasync-works-but-ilist-role-is-always-null/134843 "2024-05-23T13:33:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amartin44](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@amartin44](https://community.auth0.com/u/amartin44)\
**Post date:** [May 23, 2024, 1:33pm UTC](https://community.auth0.com/t/organizations-getallmembersasync-works-but-ilist-role-is-always-null/134843/1 "2024-05-23T13:33:26Z")

</div>

Hi,  
We use Auth0.ManagementApi package in a C# project, I try to get an IPagedList of OrganizationMember for some kind of organization’s user management. I get the list successfully, but the IList in all OrganizationMember is null.  
Based on this page, I supposed it could be not null.

My current method looks like this:

```auto
var client = await ClientFactory.GetClientAsync("read:organization_member_roles read:roles");

Auth0ManagementApi.Paging.IPagedList<Auth0ManagementApi.Models.OrganizationMember> members = await client.Organizations.GetAllMembersAsync(organizationId, new Auth0ManagementApi.Paging.PaginationInfo(0, 100, true));

foreach (var member in members)
{
	Console.WriteLine(member.Name);
	if (member.Roles != null)
	{
		if (member.Roles.Count > 0)
		{
			foreach (var role in member.Roles)
			{
				Console.WriteLine($"{role.Name}");
			}
		}
		else
		{
			Console.WriteLine("No roles found");
		}
	}
	else
	{
		Console.WriteLine("Roles is null");
	}
}

```

---

<div class="post-metadata">

**Author:** ![amartin44](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@amartin44](https://community.auth0.com/u/amartin44)\
**Post date:** [May 23, 2024, 1:34pm UTC](https://community.auth0.com/t/organizations-getallmembersasync-works-but-ilist-role-is-always-null/134843/2 "2024-05-23T13:34:35Z")

</div>

[the page I was talking about](https://community.auth0.com/t/get-organization-roles-users/72428)

---

<div class="post-metadata">

**Author:** ![adam.eichelkraut](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam.eichelkraut/32/60209_2.png) [@adam.eichelkraut](https://community.auth0.com/u/adam.eichelkraut)\
**Post date:** [January 3, 2025, 8:11pm UTC](https://community.auth0.com/t/organizations-getallmembersasync-works-but-ilist-role-is-always-null/134843/3 "2025-01-03T20:11:19Z")

</div>

Hey! I stumbled on this post because I was running into the same issue. I didn’t realize that the docs mentioned that you need to explicitly add the `fields` parameter for `role` (along with the others, i.e. `field=user_id,email,name,role`.

For C#, it means adding the `OrganizationGetAllMembersRequest` to the overloaded `GetAllMembersAsync` function like this:

```auto
var pagedList = await managementClient.Organizations.GetAllMembersAsync("org id", new OrganizationGetAllMembersRequest() { Fields = "user_id,email,name,roles" }, paginationInfo, cancellationToken);

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 20, 2025, 11:10pm UTC](https://community.auth0.com/t/organizations-getallmembersasync-works-but-ilist-role-is-always-null/134843/5 "2025-01-20T23:10:22Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
