cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Find out how Tiffany, a Customer Experience superstar uses Dropbox to keep her family in the loop when it comes to her new baby here!

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dropbox API Python

Dropbox API Python

AdanHerrera
Explorer | Level 3

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)

2 Accepted Solutions

Accepted Solutions

Re: Dropbox API Python

Greg-DB
Dropboxer

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.

 

View solution in original post

Re: Dropbox API Python

Greg-DB
Dropboxer

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

View solution in original post

3 Replies 3

Re: Dropbox API Python

Greg-DB
Dropboxer

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.

 

View solution in original post

Re: Dropbox API Python

AdanHerrera
Explorer | Level 3
Can you show me show to do this: "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."

I'm a rookie and I'm a little lost... thanks

Re: Dropbox API Python

Greg-DB
Dropboxer

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

View solution in original post

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    AdanHerrera Explorer | Level 3
What do Dropbox user levels mean?
Need more support?