cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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: 

GroupSelector

GroupSelector

TheWhistler1967
Explorer | Level 3
Go to solution

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

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

@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.)

View solution in original post

3 Replies 3

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

Hi @TheWhistler1967,

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

Hope this gives direction.

Greg-DB
Dropbox Staff
Go to solution

@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
Explorer | Level 3
Go to solution

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)

 

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?