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...
wwaag76
5 years agoHelpful | Level 6
Still not working. Here's my revised code.
async Task ListRootFolder(DropboxClient dbx)
{
folders.Clear();
var list = await dbx.Files.ListFolderAsync(string.Empty);
if (list.HasMore)
{
list = await dbx.Files.ListFolderContinueAsync(list.Cursor);
}
foreach (var item in list.Entries.Where(i => i.IsFolder))
{
folders.Add(item.Name);
}
}
Greg-DB
Dropbox Community Moderator
5 years agoYou need to check HasMore on each result, including from ListFolderContinueAsync, not just the first one. The number of total pages that will be used is not guaranteed.
Also, you should use the contents of each returned page of results. In this latest code it looks like you're only iterating through the contents of the last 'list' returned by ListFolderContinueAsync, but are ignoring the original 'list' returned by ListFolderAsync.
- wwaag765 years agoHelpful | Level 6
Just to be clear, I'm only talking about a small number of folders. Here's what's returned in my little app-14 folders.
And here's what in DB--15 folders.
I added "Folder 2" to DB, but that folder is never returned. I've changed folder names to no avail.
- Greg-DB5 years ago
Dropbox Community Moderator
The page size returned by ListFolderAsync and ListFolderContinueAsync is not guaranteed. Even if there is currently only a relatively small number of folders, the exact number of calls needed may vary, so you need to make sure you're calling back whenever HasMore is true, and checking the contents of each page.
Beyond that, make sure you're connected to the right account and app and are looking in the right place. For instance, if you're using an app with the "app folder" access type, it will only have access to the contents of the special app folder created for the app, by default at "/Apps/<app folder name>", for accounts with the English locale. Make sure you're not accidentally looking at a different copy of the folder, for instance, when comparing with the web site.
- wwaag765 years agoHelpful | Level 6
Just added a little message box indicating whether HasMore is true. It returns false, so I'll look for the other things you mentioned. Thanks for your time.
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!