Get AlarmDefinition list with GetItemsByKindmethod(kind) is not possible

I was planing to call the method called Configuration.Instance.GetItemsByKind(Kind kind) for retrieving the AlarmDefinition list. The problem is that Kind.AlarmDefinition is not defined, so it is not possible this way.

In the Component SDK, which method should be called in order to retrieve the list of AlarmDefinition?

Your observation is correct and accurately describes alarm definitions absence from the GetItems- methods.

The support for alarm definitions was introduced in XProtect 2018R2 and MIP SDK 2018R2 but only by using the Configuration API. If you run the Config API Client sample you can see how you can manage alarm definitions.

Can you confirm that I can not use the component API for it, but I have to use SOAP for sending requests to the ConfigurationApiService?

So despite I am already logged in with the component SDK, I have to login again to the ConfigurationApiService, then I can execute the following command:

ConfigurationApiServiceProxy.GetChildItems(“/” + ItemTypes.AlarmDefinitionFolder);

I guess this is the way to do it.

Is there any plan to add a method in the component SDK to get AlarmDefinition objects?

You can use the strongly typed classes instead..

Try this:

class Program
{
    const string URI = "http://localhost";
    const string USER = "";
    const string PASSWORD = "";
    const string AUTH = "Negotiate";
        
    static void Main(string[] args)
    {
        VideoOS.Platform.SDK.Environment.Initialize();
        if (Login())
        {
            VideoOS.Platform.ConfigurationItems.ManagementServer mgtServer = new VideoOS.Platform.ConfigurationItems.ManagementServer(EnvironmentManager.Instance.MasterSite.ServerId);
            var alarmDefinitons = mgtServer.AlarmDefinitionFolder.AlarmDefinitions;
            foreach (var alarmDefintion in alarmDefinitons)
            {
                Console.WriteLine(alarmDefintion.DisplayName);
            }
        }
        Console.WriteLine(Environment.NewLine + "Press any key to exit.");
        Console.ReadKey();
        Environment.Exit(0);
    }
 
    static private bool Login()
    {
        Uri uri = new UriBuilder(URI).Uri;
        CredentialCache cc = VideoOS.Platform.Login.Util.BuildCredentialCache(uri, USER, PASSWORD, AUTH);
        VideoOS.Platform.SDK.Environment.AddServer(uri, cc);
 
        //  You need this to apply Enterprise "basic" credentials. 
        //CredentialCache cc = VideoOS.Platform.Login.Util.BuildCredentialCache(uri, "test", "test", "Basic");
        //  The BuildCredentialCache can aslo build credential for Windows login ..
        //CredentialCache cc = VideoOS.Platform.Login.Util.BuildCredentialCache(uri, "myserver\\testuser", "Str0ngPa$", "Negotiate");
        // For reuse of Windows credentials ..
        //CredentialCache cc = VideoOS.Platform.Login.Util.BuildCredentialCache(uri, "", "", "Negotiate");
 
        try
        {
            VideoOS.Platform.SDK.Environment.Login(uri);
        }
        catch (ServerNotFoundMIPException snfe)
        {
            Console.WriteLine("Server not found: " + snfe.Message);
            VideoOS.Platform.SDK.Environment.RemoveServer(uri);
            return false;
        }
        catch (InvalidCredentialsMIPException ice)
        {
            Console.WriteLine("Invalid credentials for: " + ice.Message);
            VideoOS.Platform.SDK.Environment.RemoveServer(uri);
            return false;
        }
        catch (Exception)
        {
            Console.WriteLine("Internal error connecting to: " + uri.DnsSafeHost);
            VideoOS.Platform.SDK.Environment.RemoveServer(uri);
            return false;
        }
 
        Console.WriteLine("Login succeeded.");
        return true;
    }
}

(I modified the AddLayout sample.)

Thanks, your solution with the following works great:

VideoOS.Platform.ConfigurationItems.ManagementServer mgtServer = new VideoOS.Platform.ConfigurationItems.ManagementServer(EnvironmentManager.Instance.MasterSite.ServerId);
var alarmDefinitons = mgtServer.AlarmDefinitionFolder.AlarmDefinitions;