How to Retrieve Currently Registered Devices and Receive Device Add/Delete Events from a Recording Server via the MIP SDK

Hello,
I am currently developing a standalone-type plugin in which our EXE file is launched by the Milestone XProtect Event Server.
I have two questions regarding the MIP SDK.
1. How can I retrieve the hardware devices currently registered on a Recording Server through the MIP SDK?
I tried the following approach:

private cameraList;

private void FindCamera()
{
    cameraList = new List<item>();

    // Configuration.Instance : VideoOS.Platform.SDK.Platform.SDKConfiguration
    List<Item> list = Configuration.Instance.GetItemsByKind(Kind.Camera);

    foreach (Item item in list)
    {
        var list = CheckChildren(item);
        if (list.Count > 0) cameraList.AddRange(list);

    }
 
}

private List<Item> CheckChildren(Item parent)
{
    List<Item> camList = new List<Item>();

    List<Item> itemsOnNextLevel = parent.GetChildren();

    if (itemsOnNextLevel != null)
    {
        foreach (Item item in itemsOnNextLevel)
        {
            if (item.FQID.Kind == Kind.Camera && item.FQID.FolderType == FolderType.No)
            {
                camList.Add(item);
            }
            else if (item.HasChildren != HasChildren.No)
            {
                var lst = CheckChildren(item);
                if (lst.Count > 0) cameraList.AddRange(lst);
            }
        }
    }
}

In this case, Configuration.Instance is VideoOS.Platform.SDK.Platform.SDKConfiguration.
This approach appears to work correctly, but I found that devices that have already been deleted from the Recording Server are still included in the returned results.
The deleted devices are only removed from the results of Configuration.Instance.GetItemsByKind() after restarting the Milestone XProtect Event Server.
Also, since the Item.Enabled property of a deleted device is still returned as true, I could not find a reliable way to determine which devices have actually been deleted.
Therefore, I would like to know if there is a recommended way to retrieve the latest/current list of devices actually registered on the Recording Server without restarting the XProtect Event Server.
Is there another API or method that can be used to refresh or retrieve the latest device configuration?

2. Is there a way to receive an event when a new device is registered on or removed from a Recording Server?
Currently, I have tried using the following message IDs to catch configuration changes:
MessageId.System.LocalConfigurationChangedIndication
MessageId.System.SystemConfigurationChangedIndication
However, when I tested this by adding and removing devices from the Recording Server, these events did not appear to be triggered.
Is there a specific event or message ID in the MIP SDK that is triggered when a hardware device is added to or removed from a Recording Server, so that the plugin can detect these changes without restarting the XProtect Event Server?
The XProtect version I am using is 2025 R3, and the MIP SDK version is 22.3.0.
I would appreciate any guidance on the appropriate API, method, or event mechanism for handling these two scenarios.

Thank you in advance for your help.
Best regards,

In my testing, MessageId.System.SystemConfigurationChangedIndication works for camera add, remove, and configuration change scenarios, so I would recommend trying that notification.

I tested this by modifying the ConfigDump sample:

  • Made a small modification to the sample. (I just modified the configChangedHandler as shown below.)
  • Built and deployed the plugin to: C:\Program Files\Milestone\MIPPlugins\ConfigDump
  • Restarted the Event Server. (The plugin can run all environments but in this scenario we are only interested in the background plugin running in the Event Server.)
  • Added, modified, and removed cameras in XProtect.
  • Observed the output in the MIP logs (Event Server Manager → Show MIP Logs).

For debugging, you can also attach a debugger to the Event Server service and place a breakpoint in the modified handler. More on debugging Plug-ins.

Example:

private object configChangedHandler(Message message, FQID f1, FQID f2)
{
    List<FQID> fs = message.Data as List<FQID>;

    foreach (FQID fq in fs)
    {
        Item item = Configuration.Instance.GetItem(fq);

        if (item != null)
        {
            EnvironmentManager.Instance.Log(
                false,
                "ConfigDump",
                "!    Item.Name: " + item.Name,
                null);
        }
        else
        {
            EnvironmentManager.Instance.Log(
                false,
                "ConfigDump",
                "!!!! Null received",
                null);
        }
    }

    return null;
}

When a configuration change is received, you can use the returned FQIDs to inspect the affected items and update your internal device list accordingly.

Note: I would also recommend using the latest available MIP SDK version.