0

I am trying to set the InitialDirectory to a sharepoint URL

        SaveFileDialog saveDialog = new SaveFileDialog();
        saveDialog.InitialDirectory = @"https://sharepoint.mycompany.com/documents/sale/0001/";
        saveDialog.ShowDialog();

However I get the following error: You can't open this location using this program. Please try a different location.

However if I copy the web address into the top of the SaveFileDialog and press return, it opens the directory as expected.

Joseph
  • 2,706
  • 6
  • 42
  • 80

2 Answers2

0

It is not possible to call the SaveFileDialog on webpages,you'll need custom web parts along with SaveFileDialog to save a file from a given url.

Sid M
  • 4,354
  • 4
  • 30
  • 50
0

I know it's quite old, but in my case, I have to solve this issue by using WNetUseConnectionA.

This solution will allow you to open the popup asking the user to login to the SharePoint site.

Ref:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/58159e0e-aa45-4d46-a128-596c3d23ff5c/how-to-provide-credentials-to-savefiledialog-in-case-of-network-drive-access?forum=netfxbcl

Accessing a Shared File (UNC) From a Remote, Non-Trusted Domain With Credentials

kal
  • 198
  • 2
  • 9