Find and disable hardware/camera

I am attempting to create a tool (C# console app) that will find a hardware device or camera that I specify with a GUID from the command line. I want the tool to then disable or enable the device/camera as specified by another command line argument.

I have two questions:

First, I believe I can find the device/camera by getting a list of items in the configuration:

var list = Configuration.Instance.GetItems(ItemHierarchy.SystemDefined);

And then searching down through that list and it’s children until I find the device or camera I want.

My first question is: Is there a faster way to find a device or camera by GUID without having to search down through the hierarchy like this?

Second question: Once I find the device/camera, I don’t know how to enable/disable it and save the new configuration.

I am pretty much a newbie when it comes to working with the SDK (not to mention C# itself) so I wonder if I am missing something fairly obvious.

I see some notes about how this can be done using the Power Shell tools but I would like to learn how to do it with a C# app if possible.

Thanks

Please not to use Configuration.Instance.GetItems. When you disabled a camera, the method cannot get the camera item (because it is disabled). Instead, you can use configuration API, please see this link - https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_configuration_items_1_1_camera.html&tree=tree_search.html?search=videoos.platform.configurationitems.camera

What you might want to do is: do new camera (FQID fqid) and disabled it and then save it. There is Public Member Function called Camera (FQID fqid) and Save(), also a property called Enabled in the page. Please refer above link.

OK. Thanks for the suggestions. I will look into that.