Hi,
I'm writing a script that would list the resources in maintenance mode.
Using the GetResources from ResourceManagerHelper will get a list of the available resources.
The SLNet call GetResourceMessage will show the resource in Maintenance.
Is there a method to list the resources in maintenance from the helper or should the SLNet be used?
Thanks in advance.
Hi Julio,
First of all, please do never use raw SLNet messages to deal with SRM objects. There are proper managers to use, like ResourceManagerHelper, ServiceManagerHelper, etc.
As for your question, check the code below:
var resourceManager = new ResourceManagerHelper(engine.SendSLNetSingleResponseMessage);
var filter = ResourceExposers.Mode.Equal((int)ResourceMode.Maintenance);
var resources = resourceManager.GetResources(filter);
foreach (var resource in resources)
{
engine.GenerateInformation("Resource: " + resource.Name);
}