QueryAsync
Definition
Retrieves groups for the current tenant with optional paging, filtering, and sorting.
public Task<IEnumerable<GetGroupResponse>> QueryAsync(QueryOptions query = null);
Parameters
| Parameter | Description |
|---|---|
query | QueryOptions describing the requested page, filters, and sort order. Set options explicitly rather than relying on unspecified defaults. |
Returns
The asynchronous operation returns a collection of GetGroupResponse objects matching the query. The documented return type is a collection, not a response containing a total-count property.
Remarks
Use a positive, bounded Take value and a consistent sort when paging. Increase Skip by the number of records returned and stop when a page is empty. Concurrent changes can affect page contents. See QueryOptions for filter and sort examples.
Requires the updated AI Command Center group endpoint. These APIs were verified with AICC 8.3.120.4 and Tool build 8.3.120.1. Older servers without this endpoint cannot serve this request. Use GetAllGroupsAsync for the complete group list, or GetGroupByNameAsync for a lookup by name.
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.
using System;
using System.Threading.Tasks;
using IntelliBuddies.Client;
using System.Collections;
using IntelliBuddies.Client.Models.Requests;
using IntelliBuddies.Client.Models.Responses;
public async Task ReadGroupsAsync()
{
IControlRoomContext context = LoginControlRoom();
try
{
var queryOptions = new QueryOptions
{
Skip = 0,
Take = 50,
Filter = new ArrayList
{
new ArrayList { "Name", "contains", "Finance" }
},
Sort = new[]
{
new SortingInfo { Selector = "Name", Desc = false }
}
};
var groups = await context.Group.QueryAsync(queryOptions);
foreach (var group in groups)
{
Console.WriteLine($"{group.GroupId}: {group.Name}");
}
}
finally
{
context.Close();
}
}
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.