I have an app that updates all of our FileServers to point to a test server path for all of the configs for a given environment. The problem is that I got to the point where it was updating, then after looking into the FileServers form, it uses Application.FileServer instead of an IDO method to do this. So, after pouring through the code in visual studio, I managed to cobble this code below together, but the request types don't match, so I am not sure how to call this routine. Any tips?
public static void activateFileServer(Client oClient, string active, string serverName, string sharedPath, string userName, string userPassword, string remoteServerName)
{
try
{
LogonPassword lp = new LogonPassword();
lp.Value = userPassword;
FileServerActionRequestData request = new FileServerActionRequestData
{
Action = FileServerAction.Activate,
ServerName = serverName,
ServerType = "FileServer",
RootPath = sharedPath,
UserName = userName,
Password = lp,
Domain = "TST",
RemoteServer = remoteServerName,
AdditionalProps = "", // (optional)
AdditionalParms = "", // (optional)
ReservedActionType = null
};
InvokeResponseData response = oClient.Invoke(request);
FileServerActionResponseData actionResponse = FileServerActionResponseData.FromResponseData(response);
if (actionResponse.Success)
{
Console.WriteLine($"File server action '{request.Action}' succeeded.");
Console.WriteLine($"Response: {actionResponse.Response}");
}
else
Console.WriteLine($"File server action '{request.Action}' failed: {actionResponse.ErrorMessage}");
}
catch (Exception ex)
Console.WriteLine($"Error performing file server action: {ex.Message}");
}
}