Forum Discussion

TheWhistler1967's avatar
TheWhistler1967
Explorer | Level 3
3 years ago
Solved

GroupSelector

Hi there,


I have a fundamental misunderstanding of how to use 'GroupSelector'.

 

Code:

dbt = dropbox.DropboxTeam(TOKEN)
members = dbt.team_groups_members_list(g.group_id)

 Error: ValidationError: expected type dropbox.team.GroupSelector or subtype, got string

 

Ok fine, I need a GroupSelector type - but how do I actually initialize this?

 

If I do something like:

gs = dropbox.team.GroupSelector(g.group_id)

Error: AssertionError: Invalid tag 'g:<group_id>'.

 

But that doesn't make sense anyway, because to find a group it would need to be attached to a token. Like:

gs = dbt.GroupSelector(g.group_id)

But no GroupSelector' class for DropboxTeam.

 

Have read the api, I understand that there is a GroupSelector class I need to use, I just don't know how to use it in practice. Cannot find any code examples anywhere which actually uses it. Can someone help me with this? Need an explanation rather than an API link, because I have read the API section and still makes no sese.


I have a clear misunderstanding here.

 

Cheers

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

    Hi TheWhistler1967,

    Have you listed the available groups? 🧐 There should be correct id for every one entry, if any. 😉

    Hope this gives direction.

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

    TheWhistler1967 As Здравко mentioned, you can use the API to look up the existing group(s) to get the group ID(s). Then you can use that to build a GroupSelector as needed, like this:

     

    dbt = dropbox.DropboxTeam(TOKEN)
    
    # just taking the first group as an example:
    group = dbt.team_groups_list().groups[0]
    group_selector = dropbox.team.GroupSelector.group_id(group.group_id)
    members = dbt.team_groups_members_list(group_selector)

     

    (Don't forget to implementation the pagination over team_groups_list/team_groups_list_continue and team_groups_members_list/team_groups_members_list_continue.)

    • TheWhistler1967's avatar
      TheWhistler1967
      Explorer | Level 3

      Thank you very much.


      This was my problem, I didn't invoke .group_id, eg.

      group_selector = dropbox.team.GroupSelector(group.group_id)

      vs

      group_selector = dropbox.team.GroupSelector.group_id(group.group_id)

       

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,949 PostsLatest Activity: 3 hours ago
352 Following

If you need more help you can view your support options (expected response time for an email or 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!

Related Content