Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
wwaag76
5 years agoHelpful | Level 6
ListFolderAsync Does Not Return Newly Added Folders
All I want to do is get a list of subfolders within the Root folder. However, if I or another member adds a new folder, it does not show up. Here's the code I'm using.
async Task ListRootFold...
ddixit
3 years agoExplorer | Level 3
i had the same issue, i was able to fix it using while :
public static List<FolderNameModel> ListRootFolder(DropboxClient dbx, string Path)
{
List<PathModel> Paths_ = GetPath();
var folders = new List<FolderNameModel>();
var list = dbx.Files.ListFolderAsync(Path).Result;
while (list.HasMore)
{
list = dbx.Files.ListFolderContinueAsync(list.Cursor).Result;
}
foreach (var item in list.Entries.Where(i => i.IsFolder))
{
folders.Add(new FolderNameModel { FolderName = item.Name });
}
return folders;
}
Здравко
3 years agoLegendary | Level 20
Hi ddixit,
Would be really strange if the code you posted:
ddixit wrote:...
while (list.HasMore)
{
list = dbx.Files.ListFolderContinueAsync(list.Cursor).Result;
}foreach (var item in list.Entries.Where(i => i.IsFolder))
{
folders.Add(new FolderNameModel { FolderName = item.Name });
}
...
... works correct and fixes something. You just jump over all pages and list just the last one! The only difference with the 'revised' code above is that instead of only the second (or first) page you're listing only the last one. 🤷 That would work only when all folders fit in a single page. Otherwise you will miss some of the folders (all listed in pages, if any, before the last one). 😉
Good luck.
About 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!