How to enable/disable the VPS metadata using MIP SDK?

I created a plugin in a Smart Client, in which I want to activate or deactivate the VPS metadata item using a button.

First, I tried to fetch the disabled items list using :

List<Item> disabledItems = VideoOS.Platform.SDK.Environment.GetDisabledDevices(Configuration.Instance.ServerFQID.ServerId.Id);

but it seems that it didn’t work since the smart client will close automatically after running it.

Any suggestions on how to enable/disable the VPS metadata using the MIPSDK ?

You cannot reference the SDK from within a plugin. My guess is that doing so causes the crash of the Smart Client.

Please remove if you have more that reference the VideoOS.Platform.SDK and don’t supply those dll’s with your Smart Client plugin.

As an alternative you can find disabled devices using the Configuration API.

private void FindAllCameras()
{           
	ManagementServer mgt = new ManagementServer(EnvironmentManager.Instance.MasterSite.ServerId);
	foreach (var rec in mgt.RecordingServerFolder.RecordingServers)
	{
		foreach (var hard in rec.HardwareFolder.Hardwares)
		{
			foreach (var cam in hard.CameraFolder.Cameras)
			{
				label1.Text += cam.Name + " Enabled:" + cam.Enabled.ToString() + Environment.NewLine;
			}
		}
	}
}

Thank you for your reply.

I would like to ask you if there is a way to enable or disable the device using the Configuration API ?

In line with my code above..

cam.Enabled = false;
cam.Save();

Let me give you a tip. When working Configuration API fire up the Config API Client sample and see how configuration data is structured and can be manipulated. It wouldn’t perhaps have answered this question but can answer so many other questions..

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