Skip to main content
Version: Current

Connections.TestConnectionAsync

Description​

The API tests a new Connection with the specified details inside the connected AI Command Center.

Signature [C#]​

Task<string> TestConnectionAsync(NewConnection connection);

Properties​

Input​

ParameterTypeRequired / defaultDescription
connectionNewConnectionRequiredThe new connection details to be Testd.

Output​

PropertyDescription
Task<string>Returns the status as a string.

Remarks​

Use TestConnectionAsync API to Test a new Connection inside the connected AI Command Center.

Example​

C#
public async Task TestConnection()
{
IControlRoomContext context = LoginControlRoom();
try
{
NewConnection connection = new NewConnection()
{
ConnectionType = "Email Server",
Description = "API test",
Name = "olConnApiTest",
Value = new EmailServerConnectionValue()
{
ServerType = "Outlook",
ClientId = "Your outlook client id",
TenantId = "Your outlook tenant id",
ClientSecret = "Your outlook client secret",
EmailAddress = "demo@domain.com",
MailFolder = "Inbox"
}
};
var status = await context.Connections.TestConnectionAsync(connection);
System.Console.WriteLine("Status: " + status);
}
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.