Discuss Dropbox Developer & API
Hello,
Please I need help, How can I do this with Business API
import dropbox
client = dropbox.Dropbox('JCJoqsBi2DAAAAGGHFHFGH')
for entry in client.files_list_folder('').entries:
print(entry)
If you have a Dropbox Business API app with the "team member file access" permission, and want to use a user-specific API call, such as files_list_folder, you can do so using DropboxTeam.as_user.
First, you should make your DropboxTeam instance, and then use DropboxTeam.as_user to get a Dropbox instance. You can then use that Dropbox instance normally for user API calls. That would look like this:
import dropbox TEAM_MEMBER_FILE_ACCESS_ACCESS_TOKEN = '...' TEAM_MEMBER_ID = 'dbmid:...' team_client = dropbox.DropboxTeam(TEAM_MEMBER_FILE_ACCESS_ACCESS_TOKEN) user_client = team_client.as_user(TEAM_MEMBER_ID) for entry in user_client.files_list_folder('').entries: print(entry)
You can get the member ID for the desired member from the Dropbox Business API, in a TeamMemberInfo, e.g., as returned by team_members_list/team_members_list_continue or team_members_get_info, etc.
That would look like this, for example:
team_member_info = team_client.team_members_get_info([dropbox.team.UserSelectorArg.email(member_email_address)]).pop() if team_member_info and team_member_info.is_member_info(): team_member_id = team_member_info.get_member_info().profile.team_member_id
If you have a Dropbox Business API app with the "team member file access" permission, and want to use a user-specific API call, such as files_list_folder, you can do so using DropboxTeam.as_user.
First, you should make your DropboxTeam instance, and then use DropboxTeam.as_user to get a Dropbox instance. You can then use that Dropbox instance normally for user API calls. That would look like this:
import dropbox TEAM_MEMBER_FILE_ACCESS_ACCESS_TOKEN = '...' TEAM_MEMBER_ID = 'dbmid:...' team_client = dropbox.DropboxTeam(TEAM_MEMBER_FILE_ACCESS_ACCESS_TOKEN) user_client = team_client.as_user(TEAM_MEMBER_ID) for entry in user_client.files_list_folder('').entries: print(entry)
You can get the member ID for the desired member from the Dropbox Business API, in a TeamMemberInfo, e.g., as returned by team_members_list/team_members_list_continue or team_members_get_info, etc.
That would look like this, for example:
team_member_info = team_client.team_members_get_info([dropbox.team.UserSelectorArg.email(member_email_address)]).pop() if team_member_info and team_member_info.is_member_info(): team_member_id = team_member_info.get_member_info().profile.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!