1

I’m creating a c# winforms desktop program with dropbox support. The problem comes in where the user must select the file (from dropbox) that he would like to open. Is it possible to use the OpenFileDialog to display the content of the person’s dropbox account? I know you can just direct the openFileDialog to the local dropbox folder, but I don’t want to do that. This will mean that the person must have dropbox installed on that computer before they can use this function of my program. If you can’t do this, how will you use tree and list views to create your own openFileDialog? I would like to keep the design the same as the standard openFileDialog. I have read that you can create a rapper class for customising the openFileDialog but don’t know how this will work.

I have looked on google but can’t find what I’m looking for. Any advice or examples will be appreciated.

I’m using dotnet 4.5 and the dropnet library.

Thank you

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
Hendri
  • 21
  • 5
  • Is using the Dropbox API/SDK an option? https://www.dropbox.com/developers/documentation/dotnet#documentation – Johnie Karr Dec 11 '15 at 15:57
  • If the API/SDK is an option, this might get you started: http://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Files_ListFolderArg.htm – Johnie Karr Dec 11 '15 at 15:58
  • Isn't the Dropbox account automatically synchronized to a local folder if you have the Dropbox client installed? In that case it would come down to opening/saving a local file. – Thorsten Dittmar Jun 09 '16 at 14:07

1 Answers1

0

OpenFileDialog only shows existing files.

Your program can act like drop box client application and load all files to the client in a local folder. Then when you show the OpenFileDialog you can set that folder as InitialDirectory of the file dialog.

Also if you don't want to load all files, you can create dummy (empty) files on the local folder and after the user choose to show the file from OpenFileDialog, then download the file and show it to the user.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
  • That can possibly work. How will you create the dummy directory structure? I mean displaying the content of the dropbox account without downloading it to a local folder. If you can lock the open dialog to that dummy directory, then it will work. Further yes, I am not against using the dropbox api. Are you referring to v1 or v2? I only chose dropnet because it seemed like the most user friendly. – Hendri Dec 11 '15 at 19:40
  • I have never worked with drop box, it's an idea an the implementation is simple. You can find all files and folders hierarchy of the user's drop box account and create directories and zero size files. Thn as I said in the answer, show `OpenFileDialog` and choose the root directory that you created as `InitialDirectory` then after the user selects a file you can first verify if it's selected from that directory and then download it and show it to the user. You can also cache files this way. – Reza Aghaei Dec 11 '15 at 19:44
  • @Hendri It seems the post shares the main idea and answers your question. It would be great if you mark the answer as accepted :) – Reza Aghaei Jan 11 '16 at 15:16
  • Sorry I have not had a chance to try it intill now. I got it to work. The only problem is that I can't lock the openFileDialog to that directory. – Hendri Jan 12 '16 at 19:10