Connections.UpdateConnectionAsync
Description
The API updates a Connection with the specified details inside the connected AI Command Center.
Signature [C#]
Task<Connection> UpdateConnectionAsync(Connection connection);
Properties
Input
| Parameter | Type | Required / default | Description |
|---|---|---|---|
connection | Connection | Required | The connection details to update. |
Output
| Property | Description |
|---|---|
| Task<Connection> | Returns the updated connection. |
Remarks
Use UpdateConnectionAsync API to update a Connection inside the connected AI Command Center.
Example
C#
public async Task UpdateConnection()
{
IControlRoomContext context = LoginControlRoom();
try
{
string connectionName = "demo_connection";
var connection = await context.Connections.GetConnectionByNameAsync(connectionName);
var connectionValue = connection.Value as EmailServerConnection;
connectionValue.MailFolder = "Sent";
var updatedConnection = await context.Connections.UpdateConnectionAsync(connection);
var updatedConnectionValue = updatedConnection.Value as EmailServerConnection;
System.Console.WriteLine("Mail Folder: " + updatedConnectionValue.MailFolder);
}
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.