GetGroupByNameAsync
Definition
Retrieves a group by name from the current tenant.
public Task<GetGroupResponse> GetGroupByNameAsync(string groupName);
Parameters
| Parameter | Description |
|---|---|
groupName | Name of the group to retrieve. Supply a nonempty group name from your deployment. |
Returns
The asynchronous operation returns a GetGroupResponse object. The example handles a null result; confirm not-found behavior against your installed SDK build.
Remarks
Use this method when you know the group name. For partial-name filters or multiple results, use QueryAsync. Confirm name case sensitivity and invalid-input behavior against your deployed SDK and server.
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 when only the complete group list is needed.
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;
public async Task ReadGroupsAsync()
{
IControlRoomContext context = LoginControlRoom();
try
{
var group = await context.Group.GetGroupByNameAsync("Finance_Team");
if (group == null)
{
Console.WriteLine("No group was returned.");
return;
}
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.