1

I am using the following code to open SaveFileDialog to save CSV/TXT files:

    SaveFileDialog saveDialog = new SaveFileDialog();
    saveDialog.Filter = "CSV Files (*.CSV)|*.CSV|CSV Files (*.TXT)|*.TXT";
    saveDialog.RestoreDirectory = true;
    saveDialog.Title = "Save As";
    saveDialog.FileName = justFileName;
    saveDialog.InitialDirectory = "::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"; // For local network

I am following this doc to use CLSID to specify the default directory: https://www.eightforums.com/tutorials/13591-clsid-key-guid-shortcuts-list-windows-8-a.html

This code is part of a custom CSV reader, which I have written and this custom program sits on a server. I want the users to be able to save their CSV file only on their PC and not on the server. So I was wondering how I can hide the File System/Directory Structure of the server, which is shown from the SaveFileDialog, and only show the user's local PC where the file needs to be saved?

1 Answers1

1

You would be better off tackling the problem at the source - setup permissions on the network so users can't write to particular servers and shares.

Otherwise there is nothing to stop someone saving locally then copying the file to the server later.

Also, I don't quite understand why you went to the trouble of setting the initial folder to be Network shell namespace if your intent is not to save there by default.