ExplorerOperationsGetResourceFiles Method |
Retrieves list of resource files.
Namespace:
Cobra.WebService.ClientAPI.Application.Explorer
Assembly:
Cobra.WebService.ClientAPI (in Cobra.WebService.ClientAPI.dll) Version: 8.3.715.2595 (8.3.0715.2595)
Syntax Exceptions Exception | Condition |
---|
InvalidOperationException | Thrown when state of the instance of the CobraServices that generated the current ExplorerOperations is not in opened state. |
Examples
This example shows how to get list of resource files.
using Cobra.Model.WebService;
using Cobra.WebService.ClientAPI.Application.Explorer;
using Cobra.WebService.ClientAPI.Client;
.
.
.
CobraServices cobraServices = new CobraServices();
cobraServices.ServiceIdentityData.Username = "SYSADMIN";
cobraServices.ServiceIdentityData.SecurePassword = new SecurePassword();
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('P');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('A');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('W');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('O');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('R');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('D');
LoginResult loginResult = cobraServices.Login();
if (!loginResult.Success) {
Console.WriteLine("Login failed.");
return;
}
Console.WriteLine("Login Success.");
ExplorerOperations explorerOperations = cobraServices.CreateServiceOperations<ExplorerOperations>();
ResourceFilesFilter resourceFilesFilter = explorerOperations.CreateExplorerOperationsServiceArguments<ResourceFilesFilter>();
resourceFilesFilter.ResourceFileFilter = explorerOperations.CreateExplorerOperationsServiceArguments<ResourceFileFilter>();
resourceFilesFilter.ResourceFileFilter.Operator = FilterStringOperator.Like;
resourceFilesFilter.ResourceFileFilter.Value = "Demo%";
Console.WriteLine("Getting resource files...");
ResourceFileCollection resourceFiles = explorerOperations.GetResourceFiles(resourceFilesFilter);
bool hasError = false;
foreach (ServiceMessage serviceMessage in resourceFiles.GetMessages()) {
Console.WriteLine("Message Type: {0}", serviceMessage.MessageType);
Console.WriteLine("Message: {0}", serviceMessage.Message);
if (serviceMessage.MessageType == MessageType.Error || serviceMessage.MessageType == MessageType.ValidationError) {
hasError = true;
}
}
if (!hasError) {
foreach (ResourceFile resourceFile in resourceFiles) {
Console.WriteLine("Name: {0}", resourceFile.Name);
Console.WriteLine("Description: {0}", resourceFile.Description);
}
Console.WriteLine("Getting resource files completed successfully.");
}
else
Console.WriteLine("Getting resource files did not completed successfully.");
cobraServices.Logout();
See Also