Skip to main content
Version: Current

EnterpriseVariable.GetVariableByIdAsync

Description​

Gets the specified Enterprise Variable from the connected AI Command Center

Signature [C#]​

Task<EnterpriseVariable> GetVariableByIdAsync(int Id);

Properties​

Input​

ParameterTypeRequired / defaultDescription
IdintRequiredSpecify the ID of the enterprise variable to be retrieved.

Output​

PropertyDescription
Task<EnterpriseVariable>Returns the details of the specified enterprise variable.

Remarks​

Use GetVariableByIdAsync API to get information about the enterprise variable from the connected AI Command Center.

Example​

C#
public async Task GetEnterpriseVariableById()
{
IControlRoomContext context = LoginControlRoom();
try
{
int Id = 1;
EnterpriseVariable enterpriseVariable = await context.EnterpriseVariables.GetVariableByIdAsync(Id);
Console.WriteLine("Evar Name: " + enterpriseVariable.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.