How do I programmatically get realtime and historical alarms?

Use the GetAlarmDataTable method to return a DataTable object with all alarms and the values for each property of an alarm.