We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
cristpol95
8 months agoExplorer | Level 4
How to ListFolderAsync to a folder in the root folder?
Currently, I am trying to connect a WPF C# app to my Dropbox. I have the folders organized in the way you see in the image. Leaving the string empty opens the "Student" folder, however I want my app to list the contents "code" folder. I have tried using "code", "\\code", "/code" but the app always throws a path not found error.
I am not sure what I am doing wrong, any help is appreciated! If you need any more information, please let me know.
Thank you!
private async Task<List<FolderViewModel>> FetchFoldersAsync(string accessToken)
{
var items = new List<FolderViewModel>();
using (var dbx = new DropboxClient(accessToken))
{
var list = await dbx.Files.ListFolderAsync("");
MessageBox.Show(list.Entries.ToString());
foreach (var item in list.Entries)
{
BitmapImage thumbnail = null;
if (!item.IsFolder)
{
thumbnail = await FetchThumbnailAsync(dbx, item.PathDisplay);
}
items.Add(new FolderViewModel
{
Name = item.Name,
Thumbnail =
thumbnail ?? new BitmapImage(new
Uri("pack://application:,,,/Resources/Images/folder-icon.png",
UriKind.RelativeOrAbsolute)),
});
}
}
return items;
}
By default, API calls to the Dropbox API operate in the "member folder" of the connected account ("Student", in your case), not the "team space". That means that by default, the contents of the team space will not be found.
You can configure API calls to operate in the "team space" instead though, in order to interact with files/folders in the team space. To do so, you'll need to set the "Dropbox-API-Path-Root" header. You can find information on how to use this in the Team Files Guide.
- Greg-DBDropbox Staff
By default, API calls to the Dropbox API operate in the "member folder" of the connected account ("Student", in your case), not the "team space". That means that by default, the contents of the team space will not be found.
You can configure API calls to operate in the "team space" instead though, in order to interact with files/folders in the team space. To do so, you'll need to set the "Dropbox-API-Path-Root" header. You can find information on how to use this in the Team Files Guide.
- cristpol95Explorer | Level 4
Thanks a lot for your response! I applied this to my project, I am now able to connect to the "code" folder.
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!