.NET Based OPC UA Client/Server SDK
Event Monitored Items – Create Event Monitored Items


A session and a subscription with the server must be established.


The following dialog shows an example dialog for the Create Event Monitored Items service. Press the button “Show Code” to display the corresponding code, and the button “Help” to show this documentation page.


Enter the desired values for “Sampling Interval” and “Queue Size” into the corresponding input fields at “Monitoring Parameters”. To set the Sampling Interval to the same value as the Publishing Interval, enter “-1”. Check the box near “Discard Oldest” to discard the oldest values when the queue overflows. At “Monitoring Mode”, you can choose between “Reporting”, “Sampling” and “Disabled”.

Press the button “Select Node” to open a browse window for selecting the variables to monitor.


After selection, the variables are listed at “Monitored Items to Create”. Select an item and press the button “Event Filter” to add, edit or delete BaseEventTypes for each item.


Choose “Add” to open a browse window and choose additional fields to return with each event.


To modify a variable, choose “Edit” from the context menu, and double click on the value to open a dialog window for editing.


When finished, press the button “Create” to actually start monitoring the attribute “Event Notifier” of the listed items. Check the box in front of “Use Asynchronous Pattern” to call “BeginCreate” instead of “Create”.

Sample Code

The following code starts monitoring the attribute “Event Notifier” of the specified items according to the given monitoring parameters and event filter.

// get the current session from the parent form.
Session session = m_parent.Session;
// nothing to do if no session.
if (session == null)
// build list of items which have not been added yet.
List<MonitoredItem> monitoredItems = new List<MonitoredItem>();
foreach (ListViewItem item in MonitoredItemsLV.Items)
MonitoredItem monitoredItem = (MonitoredItem)item.Tag;
if (monitoredItem.ClientHandle == 0)
monitoredItem.UserData = item;
// create monitored items.
List<StatusCode> results = m_subscription.CreateMonitoredItems(
new RequestSettings() { OperationTimeout = 10000 });
// update results in the list.
for (int ii = 0; ii < results.Count; ii++)
UpdateItem((ListViewItem)monitoredItems[ii].UserData, monitoredItems[ii]);
// adjust widths.
foreach (ColumnHeader header in MonitoredItemsLV.Columns)
header.Width = -2;
catch (Exception exception)
ExceptionDlg.ShowInnerException(this.Text, exception);
Cursor = Cursors.Default;