Skip to main content
Version: Current

GetAllGroupsAsync

Definition​

Gets all groups for the current tenant.

C#
public Task<IEnumerable<GetGroupResponse>> GetAllGroupsAsync();

Parameters​

This method has no parameters.

Returns​

The asynchronous operation returns a collection of GetGroupResponse objects.

Remarks​

Use this method when you need all groups without filtering or paging. For large result sets, use QueryAsync to request bounded pages on a compatible server.

This method remains available when connecting to older AI Command Center versions. Use an SDK assembly that includes this method. The other two group lookup methods require the updated server endpoint.

Example​

Add the namespaces below at the top of your code file. Place the example method and connection helper in the same class. Replace example names and filters with values from your deployment.

C#
using System;
using System.Threading.Tasks;
using IntelliBuddies.Client;

public async Task ReadGroupsAsync()
{
IControlRoomContext context = LoginControlRoom();
try
{
var groups = await context.Group.GetAllGroupsAsync();
foreach (var group in groups)
{
Console.WriteLine($"{group.GroupId}: {group.Name}");
}
}
finally
{
context.Close();
}
}
Connection helper
public IControlRoomContext LoginControlRoom()
{
string RequiredSetting(string name) => Environment.GetEnvironmentVariable(name) ?? throw new InvalidOperationException($"Set {name} before running this example.");
string serverUrl = RequiredSetting("INTELLIBUDDIES_SERVER_URL");
string userName = RequiredSetting("INTELLIBUDDIES_USERNAME");
string password = RequiredSetting("INTELLIBUDDIES_PASSWORD");
string connectionString = $"ServerUrl={serverUrl};UserName={userName};Password={password}";
IControlRoomContext context = new ControlRoomContext(connectionString);
context.Open();
return context;
}

See Get started for namespaces, configuration, and context cleanup, and SDK usage for error handling.