Users.GetCurrentUserAsync
Description
Gets the current user's UserInfo details from the connected AI Command Center.
Signature [C#]
Task<UserInfo> GetCurrentUserAsync();
Properties
Output
| Property | Description |
|---|---|
| Task<UserInfo> | Returns current user's information. |
Remarks
Use GetCurrentUserAsync API to get current user's UserInfo information from the connected AI Command Center.
Example
C#
public async Task GetCurrentUser()
{
IControlRoomContext context = LoginControlRoom();
try
{
UserInfo userInfo = await context.Users.GetCurrentUserAsync();
System.Console.WriteLine("Username: " + userInfo.UserName);
}
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.