Skip to main content

Connections.UpdateConnectionAsync

Description

The API updates a Connection with the specified details inside the connected Control Room.

Signature [C#]

Task<Connection> UpdateConnectionAsync(Connection connection);

Properties

Input

PropertyDescription
ConnectionThe connection details to update.

Output

PropertyDescription
Task<Connection>Returns the updated connection.

Remarks

Use UpdateConnectionAsync API to update a Connection inside the connected Control Room.

Example

C#
public void UpdateConnection()
{
IControlRoomContext context = LoginControlRoom();

string connectionName = "demo_connection";

var connection = Task.Run(() => context.Connections.GetConnectionByNameAsync(connectionName)).Result;

var connectionValue = connection.Value as EmailServerConnection;
connectionValue.MailFolder = "Sent";
var updatedConnection = Task.Run(() => context.Connections.UpdateConnectionAsync(connection)).Result;

var updatedConnectionValue = updatedConnection.Value as EmailServerConnection;
System.Console.WriteLine("Mail Folder: " + updatedConnectionValue.MailFolder);
}
C#
public IControlRoomContext LoginControlRoom()
{
IControlRoomContext context;
string connectionString;

connectionString = "ServerUrl=https://demo.onnitellibuddies.com;UserName=demoadmin;Password=password";
context = new ControlRoomContext(connectionString);

context.Open();
return context;
}