Hi Dojo,
I am currently working on a download function in IAS.
I am trying to use FolderBrowserDialog from Systems.Windows.Forms to launch a window dialog for users to select the directory path the file should be saved in.
However, I am currently facing this error.
Script Failure (Playout Excel Script): EXIT: "Run|Something went wrong: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
at System.Windows.Forms.CommonDialog.ShowDialog()
at Playout_Excel_Script_1.Script.RunSafe(IEngine engine)
at Playout_Excel_Script_1.Script.Run(IEngine engine)" (see comment for more details)
This is the code that is used:
using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
{
folderBrowserDialog.Description = "Select a folder to save the file";
folderBrowserDialog.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
// Get the selected path
string selectedFolderPath = folderBrowserDialog.SelectedPath;
engine.GenerateInformation(selectedFolderPath);
}
}
Could anyone assist me on this error message? or is there a better way to allow users to select directory path?
Thanks
Hi,
FolderBrowserDialog cannot be used in an IAS, since that runs on the server and not on the client itself. Your code would try to open the FolderBrowserDialog on the DataMiner server.
What you could do instead, is using the FileSelector component from the IAS toolkit.
This page describes how to get started with the IAS Toolkit.
Hi Tom! Thanks for your answer!
Yes, I am using the FileSelector for my uploads. However, it does not work for my downloads as I need to select a directory instead of a file. I might opt for the user to input the directory folder path in a textbox instead.