We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
roman prog 89 level_
4 years agoExplorer | Level 3
Dropbox API C#
Hello! Tell me please
How to write C # code correctly.
For a complete list of Teams folders and files.
Here is a sample code to get a list of folders for a single Dropbox user.
using (var dbx = new DropboxClient(token))
{
var list = await dbx.Files.ListFolderAsync(string.Empty, true);
foreach (var item in list.Entries.Where(i => i.IsFolder))
{
Console.WriteLine(item.PathDisplay);
}
}
For a list of Team folders or All Dropbox users. i am trying this method. But the list of folders is not complete.
using (var client = new DropboxTeamClient(token))
{
var members = await client.Team.MembersListAsync();
foreach (var member in members.Members.OrderBy(a => a.Profile.Email))
{
var Name = member.Profile.Name.DisplayName;
Console.WriteLine(Name);
var userClient = client.AsMember(member.Profile.TeamMemberId);
var list = await userClient.Files.ListFolderAsync(string.Empty, true);
var x = list.Entries.Where(i => i.IsFolder); //i.IsFolder);
foreach (var item in x) //list.Entries.Where(i => i.IsFolder));
{
Console.WriteLine(item.PathDisplay);
}
}
When using code like this. the list of root folders turns out to be correct, but does not show subfolders.
using (var dbx = new DropboxClient(token))
{
var accountInfo = await dbx.Users.GetCurrentAccountAsync();
Console.WriteLine(accountInfo.RootInfo.RootNamespaceId);
var dbx2 = dbx.WithPathRoot(new Dropbox.Api.Common.PathRoot.Root(accountInfo.RootInfo.RootNamespaceId));
var list = await dbx2.Files.ListFolderAsync(string.Empty, true);
var PathFolder = list.Entries.Where(i => i.IsFolder);
foreach (var item in PathFolder)
{
Console.WriteLine(item.PathDisplay);
}
}
What is the correct code to get a complete list of all folders and subfolders in the Dropbox team?
The ListFolder interface is paginated, and so you aren't guaranteed to get everything returned in one call like this. You'll need to also implement the ListFolderContinueAsync method. Please refer to the ListFolderAsync documentation for more information.
I also recommend reading the File Access Guide and Team Files Guide.
- Greg-DBDropbox Staff
The ListFolder interface is paginated, and so you aren't guaranteed to get everything returned in one call like this. You'll need to also implement the ListFolderContinueAsync method. Please refer to the ListFolderAsync documentation for more information.
I also recommend reading the File Access Guide and Team Files Guide.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf 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!