Discuss Dropbox Developer & API
Now I have been so far successful listing the users in a dropbiox business account and listing their files and folders successfully
Some snippets of code related to it are
const dbx: any = new Dropbox({ accessToken: access_token, fetch: fetch, selectUser: team_member_id });
if (cursor === "") { result = await retry(() => dbx.filesListFolder({ path: "", recursive: true })); } else { result = await retry(() => dbx.filesListFolderContinue({ cursor })); }
Now I need to list all the team folders and its content too along with user specific content For it I tried
const dbx: any = new Dropbox({ accessToken: access_token, fetch: fetch, });
if (cursor === "") { result = await retry(() => dbx.filesListFolder({ path: "/team_folder", recursive: true })); } else { result = await retry(() => dbx.filesListFolderContinue({ cursor })); }
but I am getting error
error: `Error in call to API function "files/list_folder": This API function operates on a single Dropbox account, but the OAuth 2 access token you provided is for an entire Dropbox Business team. Since your API app key has team member file access permissions, you can operate on a team member's Dropbox by providing the "Dropbox-API-Select-User" HTTP header or "select_user" URL parameter to specify the exact user <https://www.dropbox.com/developers/documentation/http/teams>.`
require your help in detailed understanding of the issue
@biswas_nu wrote:...
require your help in detailed understanding of the issue
Hi @biswas_nu,
Your issue is that tokens don't impersonate anybody personally when they authenticate a team. File access of any type require user/member to be acting though (the team on its own cannot be acting side)! That's why you need to add member information while working on team account files with team tokens as noted in the error message. One thing that is missing in the error message is that you can make team folder content list as admin too, not only as user having access to there (i.e. you may and have to use either selectAdmin or selectUser option).
Hope this helps.
This value comes however in case of user file
2024-09-13T12:33:46.823Z 7b23231c-d109-59e2-9a4e-7c42e2455f91 INFO Entry for normal file: {
'.tag': 'file',
name: 'IMG_2234.MOV',
path_lower: '/cloudportal_restore_05c52d00-701f-11ef-ae02-55ed4bd144bc/photos and videos/saaher iphone 5s/965yokdj/img_2234.mov',
path_display: '/CloudPortal_Restore_05c52d00-701f-11ef-ae02-55ed4bd144bc/Photos and Videos/Saaher iphone 5s/965YOKDJ/IMG_2234.MOV',
id: 'id:bIDhMLTvgPsAAAAAAAAVzw',
client_modified: '2024-09-11T09:23:21Z',
server_modified: '2024-09-11T09:23:22Z',
rev: '01621d48a95676d00000001314ef691',
size: 26728433,
is_downloadable: true,
content_hash: '77da2ab8c10808a72062a8cb809543f8372ba763519fdea0ff6d59b4c76eaa57'
}
@biswas_nu wrote:This value comes however in case of user file
...
Hm..🤔 To be honest, I'm not certain what exactly you mean here.
If you mean that when you get token for non-team account or token for a team member without team scopes it works, then of course would be strange to be otherwise. Such a token doesn't represent a team, but a person (either as an account owner or pointing precise team member - not the entire team). That's why in such a case you don't need to specify exact person explicitly - it's already specified on authentication and associated to the token.
If you mean something else, clarify what you mean exactly.
Hope this clarifies matter.
[Cross-linking for reference: https://stackoverflow.com/questions/78980867/issue-listing-team-folders-with-dropbox-javascript-sdk ]
I see Здравко already helpfully offered some guidance here. The following resources may also serve as useful references:
If you have any remaining questions, feel free to reply and clarify.
Hello Legendary
Let me explain the problem in detail
When using selectAdmin : <team_member_id of admin> and calling listfolder and listfoldercontinoue with the folder id, I am able to see all the files in team folder but not their path
When using selectAdmin : <team_member_id of admin> and calling listfolder and listfoldercontinoue with the folder id, I am able to see all the files in team folder but not their path
the data does not contain the filePath for the team files
@biswas_nu, Can you take a look on your result posted above? You may see there files "path_lower" and "path_display". Do they absent in some of your list results? 🧐 That's the paths of all entries - files and folder in the list results.
Something that may confuse you is that such paths are rooted to the selected namespace (in your case - member home folders or shared team folders). Leading folder names are missing and if you don't know where you can find them - in your list results for such folders you made at the beginning (where your team_folder_id comes from).
Some other confusion may be incorrect paths symbols case - even in display paths. Only last entry in such a path is guaranteed correct. All preceding, if any, may be messed - messed path symbols case!
If something else confuse you, again, be more concrete.
Hello @Здравко
They are missing in case of team folder files when access them using selectAdmin: <team member id>
Hi there!
If you need more help you can view your support options (expected response time for a 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!