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

Ilya_C's avatar
Ilya_C
Explorer | Level 3
7 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 ?

  • 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