How to get a list of child (sub) sites of the current (top) site from event server plugin?

From a background plugin (event server), I want a list of all child sites.

How can I do this?

The goal is to connect an alarmclient to each sub site and be able to get alarmlist for all sites

@Bo Ellegård Andersen (Milestone Systems)​ or @Rie Kiuchi (Milestone Systems)​ could you please help?

Please see the MultiSiteViewer sample, how it log in on multiple sites. Also; the Multi-Site Status Viewer actively opens for multiple MessageCommunication targets, the task you have is similar.

https://doc.developer.milestonesys.com/html/index.html?base=samples/multisiteviewer.html&tree=tree_2.html

https://doc.developer.milestonesys.com/html/index.html?base=samples/multisitestatusviewer.html&tree=tree_2.html

@Bo Ellegård Andersen (Milestone Systems)​ Thanks for your reply! I checked this sample again, and noticed I forgot to do a part of the code. I’m able to open an alarmclient to a different site.

The only problem I’m still facing is to get a list of subsites. When I do this from event server plugin, I get 0 items:

    Item item = EnvironmentManager.Instance.GetSiteItem(EnvironmentManager.Instance.MasterSite);

   List<Item> test =  item.GetChildren();

Tried many other ways but still no luck.

In the Multi-Site Status Viewer this code is used to load top site:

Item siteItem = VideoOS.Platform.SDK.Environment.LoadSiteItem(uri, _credentialCache);

When I do this, I see this error in the MIP logs of event server:

Error BuildSiteInfo Unable to cast object of type ‘VideoOS.Event.Server.MIP.Environment.ESConfiguration’ to type ‘VideoOS.Platform.SDK.Platform.SDKConfiguration’.

The Event Server environment is very much single site oriented, there is no way to know the other sites in that environment.

There are two possibilities.

  1. Have the plugin in the master Events Server communicate with plugins in Event Servers in the child sites.
  2. Transform your Event Server plugin to a standalone service capable of logging in on all the sites involved.