Forum Discussion

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

List files and folders in dropbox sdk

 
 

I need to get the list of files and folders from my account with dropbox SDK .Net. Simple Code :

static async Task ListRootFolder(DropboxClient dbx)
    {
        var list = await dbx.Files.ListFolderAsync(string.Empty);
        foreach (var item in list.Entries.Where(i => i.IsFolder))
        {
            Console.WriteLine("D  {0}/", item.Name);
        }

        foreach (var item in list.Entries.Where(i => i.IsFile))
        {
            Console.WriteLine("F{0,8} {1}", item.AsFile.Size, item.Name);
        }
    }

dbx object - is correct, but list is null. no one files in Console, but they are exists in account.

 

 

Message = "Cannot access a disposed object.\r\nObject name: 'System.Net.Http.HttpClient'."

 

Where is a error ?

1 Reply

  • Hello Ilya_C,

     

    I was able to run your method and I got back a successful file listing so I don't think there is an issue with what you have in that method as far as the Dropbox API.

     

    Can you share a more complete code example of how you're calling that method and creating the dbx object?

     

    Also, can you confirm if you are using this on a Dropbox account with team space and member folders enabled? If you are not sure what that is, please take a look at the namespace guide here:
    https://www.dropbox.com/developers/reference/namespace-guide

     

    Thanks,

     

    -Chuck

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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, Facebook or Instagram.

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!