Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
cristpol95
2 years 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.
2 Replies
Replies have been turned off for this discussion
- Greg-DB2 years ago
Dropbox Community Moderator
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.
- cristpol952 years agoExplorer | 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.
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!