Forum Discussion

AlvaroHuertas's avatar
AlvaroHuertas
Explorer | Level 3
2 years ago

How can I retrieve all my folders shared with teams in Python?

Hi!

 

I'm trying to retrieve all the folders inside my Dropbox account. In the first approach I'm just able to retrieve the info from something like my "home folder" but there is other folders that I created as the admin that are not being showed calling 'files_list_folder()' function.

 

I'm instantiating my DB account as 

 

 

dbx = dropbox.Dropbox(oauth2_refresh_token=REFRESH_TOKEN, app_key=APP_KEY)

 

 

 

I tried to use DropboxTeam like that:

 

 

dbx = dropbox.DropboxTeam(oauth2_refresh_token=REFRESH_TOKEN, app_key=APP_KEY).as_admin(ADMIN_ID)
dbx.files_list_folder("")

 

 

 

But I'm getting this error:  'dropbox.exceptions.BadInputError: BadInputError('a5c6fcd46470407982efeb801ea9c3ac', 'Error in call to API function "files/list_folder": Unexpected select user header. Your app does not have permission to use this feature')'

 

Any solutions to this?

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    AlvaroHuertas, have you selected some team scope for your application 🤔 or not yet? Without team scope you can't use team related features even when the API call, you're using, doesn't require such scopes! In such cases the call will be rooted to the home scope and you can't change this. Keep in mind that when you change some application scope, you need to authenticate your application anew (such changes are NOT retroactive) - OAuth anew.

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff

      AlvaroHuertas Looking at the error and code, as Здравко said, it looks like you're trying to use a feature that your app is not actually configured for. For example, if your app is not team-linked, you wouldn't use as_admin.

       

      And for information on how to access the team space, check out the Team Files Guide.