Why does VideoOS.Platform.Proxy.AlarmClient.IAlarmClient.Add ( VideoOS.Platform.Data.Alarm alarm ) throw the 'AlarmServiceFault' exception? What alarm parameters are compulsory to make it work?

You might have already seen this link but let me introduce it to you first. https://doc.developer.milestonesys.com/html/index.html?base=miphelp/interface_video_o_s_1_1_platform_1_1_proxy_1_1_alarm_client_1_1_i_alarm_client.html&tree=tree_search.html?search=ialarmclient.add

I tested with LibraryEventGenerator sample and it worked without error, so please explore it. I added following code in FireSendAlarmClick in EventForms.cs,

AlarmClientManager _alarmClientManager;
_alarmClientManager = new AlarmClientManager();
IAlarmClient alarmClient = _alarmClientManager.GetAlarmClient(EnvironmentManager.Instance.MasterSite.ServerId);
alarmClient.Add(alarm);

Thanks for your support. I got it to send the alarm.

Below is an instance of the alarm the sample app sends to the server.

Alarm alarm = new Alarm()

     {

        EventHeader = eventHeader,

           StateName = "In progress",

           State = 4,

           AssignedTo = "test ([\\\\test)](file://test\))",               

       };

Why can’t I send the alarm if I add more parameters to the alarm than shown in the above snippet?

I tested this and it works for me. I am guessing that data in the wrong format could cause the alarm to be unable to send. If you share a snippet of code I could see if I detect something not correct.

My experiment / code -

Alarm alarm = new Alarm()
{
	EventHeader = eventHeader,
	StateName = "In progress",
	State = 4,
	AssignedTo = "test (\\test)",
	Vendor = new Vendor() { Name = "kjvkzd" },
	Description = "Description"
};

Also, we noticed that the sample app executes “EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(MessageId.Server.NewAlarmCommand) { Data = alarm });” without exceptions but the alarm is not always logged in smart client.

Why does the server log the alarm only some of the time and not all the time?

Try to examine the Event Server logs. Do you see errors to explain that the alarms are not correctly received or used in the Event Server?

(See [c:\ProgramData\Milestone\XProtect](file:c:/ProgramData/Milestone/XProtect) Event Server\logs\ and [c:\ProgramData\Milestone\XProtect](file:c:/ProgramData/Milestone/XProtect) Event Server\logs\MIPLogs\)

Recommended read - https://developer.milestonesys.com/s/article/Create-an-alarm-from-a-MIP-SDK-based-application

and another recommended read - http://download.milestonesys.com/MIPSDK/Samples/TriggerAlarmFromExternal-ConceptSolution.pdf