We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
gbc04
3 years agoExplorer | Level 3
Folder searches using the API often fail.
I created a function to download data files at the desired time by searching folders by date in a program (C#) through App Key (OAuth 2) and used it for several years. However, from 09-12 to the 12t...
Greg-DB
Dropbox Community Moderator
3 years agoI'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:
- the name and version number of the platform and SDK/library you are using, if any
- the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
- the full text of any error or unexpected output
gbc04
3 years agoExplorer | Level 3
* SDK information is [Official Dropbox .Net v2 SDK v5.0.7591]
* Source Code
using (var dbx = new DropboxClient(Program.ConfigIni.BaseInfo.DropBoxApiTokenKey))
{
string DownForderName = "/" + Program.ConfigIni.BaseInfo.ServerOpenPath;
var aData = await dbx.Files.ListFolderAsync(DownForderName);
//When loading here, only part of the folder information is displayed, but all is displayed in the dropbox program.
var list = aData.Entries.OrderBy(x => x.Name).ToArray();
//show folders then files
foreach (var item in list.Where(i => i.IsFolder))
{
IsActivce = true;
string FileFullPath = "";
FileFullPath = item.Name;
var ForderInFiles = await dbx.Files.ListFolderAsync(DownForderName + "/" + item.Name);
foreach (var Files in ForderInFiles.Entries.Where(i => i.IsFile))
{
~~~
}
}
}
- Здравко3 years agoLegendary | Level 20
gbc04 wrote:...
var aData = await dbx.Files.ListFolderAsync(DownForderName);//When loading here, only part of the folder information is displayed, but all is displayed in the dropbox program.
var list = aData.Entries.OrderBy(x => x.Name).ToArray();...
Hi gbc04,
How many are all files/folders in the folder, that's object of listing/enumeration? Keep in mind that 'ListFolderAsync' only starts the listing (and possibly completes it when short enough). Its result is the first page from the result and eventually the only, but may be more pages! There is a flag that shows whether are more pages or just received page is the last - you never checked it in your code. When there are more pages, you have to continue pagination to the last one - something you skipped.
Hope this gives direction.
- Greg-DB3 years ago
Dropbox Community Moderator
gbc04 Здравко is correct; you need to implement both ListFolderAsync and ListFolderContinueAsync. You aren't guaranteed to get all results back in just one call to ListFolderAsync. Please refer to the documentation linked there for information on how to use this.
About Discuss Dropbox Developer & API
Make connections with 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!