You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

GErler01's avatar
GErler01
Explorer | Level 3
8 years ago

Path for .NET SDK thumbnails

The .NET SDK examples seen to be thin.  I am looking to display thumbnails from image files on Dropbox.   I have the BeginGetThumbnail method but am having difficulty implementing it.   It is returning null for me.  Is this an async method??

  • Greg-DB's avatar
    Greg-DB
    8 years ago

    1. To set parameters like those, you should supply values like this:

      var asyncResult = this.client.Files.BeginGetThumbnail (path, Dropbox.Api.Files.ThumbnailFormat.Jpeg.Instance, Dropbox.Api.Files.ThumbnailSize.W64h64.Instance); 

    2. That IsPhoto is unfortunately not what you're looking for. That just tells you the particular subtype of a MediaMetadata instance. If you want to check the type of a file, you should check its file extension. You can then compare the extension against the list of supported extensions for GetThumbnail.

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

    If you use BeginGetThumbnail, you'll need to also use EndGetThumbnail. The Begin method fires up an async operation and the End method blocks until it completes. That would look something like this:

     

    var asyncResult = this.client.Files.BeginGetThumbnail (path);
    // ...
    var thumbnailResult = this.client.Files.EndGetThumbnail (asyncResult);

     

    It shouldn't return null though, and it seems to be working for me. Can you share the code that's giving you trouble?

     

    Alternatively, you can use just GetThumbnailAsync like this:

     

    var thumbnailResult = await this.client.Files.GetThumbnailAsync(path);

     

    • GErler01's avatar
      GErler01
      Explorer | Level 3

      Thanks for the info.  Got things going the right direction.  I thought I needed to used the EndGetThumb but wasn't sure where it fit in the puzzle.   On the topic of thumbs - is it possible to call all the thumb for files that are images in a folder or do I have step thru them . 

      Thx

      G

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

        No, unfortunately the API doesn't offer a way to get thumbnails in bulk like that, but I'll be sure to pass this along as a feature request. You'll need to call for each one you need.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,919 PostsLatest Activity: 11 hours ago
334 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!