Forum Discussion

Sorliden's avatar
Sorliden
New member | Level 2
6 years ago

Access free folders and files with Dropbox.Api 4.9.4 in .Net

Hi!

I have been provided with a Dropbox URL (https://www.dropbox.com/sh/<code1>/<code2>) where I can access folders and download zip files in my web browser without providing any credentials.

How do I use the Dropbox.Api 4.9.4 in .Net to do the same thing?
* List content
* Navigate to sub folders
* Download files

What are code1 and code2 in the "Dropbox.Api terminology"?

I have tried to 

Best regards
  Sorliden

 

 

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The Dropbox API doesn't offer exactly the same interface as the shared link web site itself, but here's what is available:

    • to list the contents of a shared link for a folder: ListFolderAsync with the 'sharedLink parameter'
    • to list the contents of a nested folder of a shared link for a folder: ListFolderAsync with the 'sharedLink' and 'path' parameters
    • to download a file from a shared link for a file: GetSharedLinkFileAsync with the 'url' parameter
    • to download a file from inside a shared link for a folder: GetSharedLinkFileAsync with the 'url' and 'path' parameters

    Note though that these methods currently only support "user authentication", so they can't be used anonymously like the web site can. You'll need to supply an access token.

    Also, when supplying the shared link a 'sharedLink' or 'url' parameter, you should just provide the entire link. There isn't any need to deconstruct these links and use the individual path components ('code1 and code2' in your example).

    • Sorliden's avatar
      Sorliden
      New member | Level 2

      Thanks for the fast answer!

      I guess I have to convince my information provider to lock the information and require credentials. Feels a little bit odd.

      Or can you recommend any other solution of this problem? 
      Dropbox.Api 4.9.4 seems to be the Dropbox API that is most alive (on https://www.nuget.org/) but it is not a requirment for me. But .Net is a requirment. 

      Or can you implement an anonymous access token, fast? ;-)

      Best regards
        Sorliden

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Using the API as I described above would offer you the most control over the integration, but one other solution would be to download from the link directly, without using the API. There's information here on how you can modify these shared links for direct access. You can then programmatically download from the modified link, using an HTTPS GET request, following redirects, with the HTTPS client of your choise. For shared links for folders, that would result in a zip download of the entire folder. You could then unzip that locally and use the contents as desired.

        I'll also pass this along as a feature request for an anonymous way to do this on the API, but I can't promise if/when that would be implemented.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,941 PostsLatest Activity: 2 hours ago
350 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!