We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
trithanhnguyen
3 years agoHelpful | Level 6
dbxClient.files().listFolder("") only returns 1 folder
I want to list all the files under my member ID. I use the following code and it only show 1 folder even though I have 8 folders starting from root.
DbxClientV2 dbxClient = dbxTeamClient.asMemb...
- 3 years ago
trithanhnguyen wrote:... Do I need to do some extra setup to list all 3 folders. Thanks.
In all cases you need to set your root to appropriate one using withPathRoot in addition to asMember, if desired folders reside in out of your account's user/member home (as seems it is).
Здравко
Legendary | Level 20
trithanhnguyen wrote:I want to list all the files under my member ID. I use the following code and it only show 1 folder even though I have 8 folders starting from root.
...
You are listing all files in your user/member home folder (recursive eventually). If your rest folders are team folders/spaces then you need to enumerate your root. On personal accounts root matches home, but on business account home is only part on all root content!
Hope this gives direction.
trithanhnguyen
3 years agoHelpful | Level 6
From 8 folders I have in my account, 3 of them I created by myself. So at least the list folder API should return that 3 folders, but it did not. Do I need to do some extra setup to list all 3 folders. Thanks.
- Здравко3 years agoLegendary | Level 20
trithanhnguyen wrote:... Do I need to do some extra setup to list all 3 folders. Thanks.
In all cases you need to set your root to appropriate one using withPathRoot in addition to asMember, if desired folders reside in out of your account's user/member home (as seems it is).
- trithanhnguyen3 years agoHelpful | Level 6
You can re-produce what I have by create a Dropbox account. Then create 3 folders and upload or create some files and folders under the them. Then write a test program that using the List Folder API on the account. You will see that the API only returns the contents of one folder.
Thanks.
- Здравко3 years agoLegendary | Level 20
The main question is where you have created all those folders? You seems don't use personal, but business account! In such a case when you create a folder aside your home folder you create another team folder (out of your home folder). As Greg noted, by default API uses Home folder (the one you are listing only). To list something outside it, simply you need to get out of your home. 😉 That's it. Just use the features mentioned.
- Greg-DB3 years agoDropbox Staff
trithanhnguyen Yes, as Здравко indicated, it sounds like you're looking for the contents of your "team space", but note that by default, API calls operate in the "member folder" of the connected account, not the "team space", so you won't see the contents of your team space when making API calls by default. You can configure API calls to operate in the "team space" instead though. To do so, you'll need to set the "Dropbox-Api-Path-Root" header. You can find information on this in the Team Files Guide. With the Java SDK, you can set that header using withPathRoot.
- trithanhnguyen3 years agoHelpful | Level 6
Thank Здравко and Greg,
When I set the withPathRoot with my Team Root Namespace then the List Folder API returns all the folders and files under my Team Namespace. I do not want that. I just want to list all the folders and files in my account. There are 3 folders which I created in my personal account. However, when I use this API call:
ListFolderResult fileRes = dbxClient.files().listFolderBuilder("").withRecursive(true).start();
It just returns 1 folder and all the contents under that 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!