cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

How to 'operate on a team member\'s Dropbox' in python

How to 'operate on a team member\'s Dropbox' in python

TheWhistler1967
Explorer | Level 3
Go to solution

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

 

Code:

dbx = dropbox.Dropbox(TOKEN)
response = dbx.files_list_folder(path='', recursive=True)
print(response)

 

Hi there,

 

What is the actual python code for this? I have the users dbid for use to operate on. But I cannot find the actual python syntax for this.
What lines do I need to add to the above code to get a print for this.


Cheers

1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20
Go to solution

@TheWhistler1967 wrote:

Ok so it seems this is a DropboxTeams thing, so maybe this is closer:

...
dbx_t_as_user = dbx_t.as_user("dbid:<string>")
...

 ...


Hi @TheWhistler1967,

As far as I can see, you are trying use your account id (starts "dbid") as a team member id (starts "dbmid"). 🤫 Select the correct identifier. 😉

Hope this helps.

View solution in original post

4 Replies 4

TheWhistler1967
Explorer | Level 3
Go to solution

Ok so it seems this is a DropboxTeams thing, so maybe this is closer:

dbx_t = dropbox.DropboxTeam(TOKEN)
dbx_t_as_user = dbx_t.as_user("dbid:<string>")
response = dbx_t_as_user.files_list_folder('')

 But a new error:

'Error in call to API function "files/list_folder": Invalid select user id format'

Здравко
Legendary | Level 20
Go to solution

@TheWhistler1967 wrote:

Ok so it seems this is a DropboxTeams thing, so maybe this is closer:

...
dbx_t_as_user = dbx_t.as_user("dbid:<string>")
...

 ...


Hi @TheWhistler1967,

As far as I can see, you are trying use your account id (starts "dbid") as a team member id (starts "dbmid"). 🤫 Select the correct identifier. 😉

Hope this helps.

Greg-DB
Dropbox Staff
Go to solution

That's correct, for accessing user endpoints using a team-linked access token like this, you'll need to specify the member to operate on. You can find the documentation for this here.

 

In the Python SDK, you can use as_user (or as_admin) for this.

 

These require a team member ID, which starts with "dbmid:", not an account ID, which starts with "dbid:". You can get team member IDs from a number of places on the API, such as team_members_get_info_v2, team_members_list_v2/team_members_list_continue_v2, etc.

TheWhistler1967
Explorer | Level 3
Go to solution

Thanks - this was exactly correct. Marked other one as solution. Cheers.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    TheWhistler1967 Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?