When using SaveFileDialog
and selecting to save in a folder in which the user has no permission to write to, a warning dialog appears and prevents the user from continuing.
var sfd = new SaveFileDialog
{
FileName = name,
InitialDirectory = initial,
Filter = "Text (.txt)|*.txt",
DefaultExt = ".txt"
};
var result = sfd.ShowDialog();
Is there any way to prevent this validation, while continuing using the SaveFileDialog
, without resorting to elevating the process?
Short answer: No.
There is no setting or property that you can use to bypass the security mechanism of the operating system.
Set the InitialDirectory
property to a folder that you know that users have write access or endure the warning.