Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi All,
I have a Business Advance Account. I want to keep track a list of active members of my team. So I have the following code to list all my team members; it works fine.
static public void getUsers(DbxTeamTeamRequests team)
{
try
{
MembersListResult memberList = team.membersList();
memberCursor = memberList.getCursor();
while(true)
{
List<TeamMemberInfo> members = memberList.getMembers();
for(int i = 0; i < members.size(); i++)
{
TeamMemberInfo member = members.get(i);
System.out.println(member.toStringMultiline());
}
if(memberList.getHasMore())
{
try{
memberList = team.membersListContinue(memberCursor);
memberCursor = memberList.getCursor();
}
catch (DbxException e){
e.printStackTrace();
}
}
else
{
break;
}
}
}
catch (DbxException e)
{
throw new RuntimeException(e);
}
}
//
However I want to update the list in the interval of 5 minutes. So I have the thread that wakes up in every 5 minutes and run this code:
static public void getMemberLogEvents(DbxTeamTeamLogRequests teamLog)
{
GetTeamEventsResult eventRes = null;
try
{
eventRes = teamLog.getEvents(); //Connect and get events from DropBox server.
eventCursor = eventRes.getCursor();
}
catch (DbxException e1)
{
e1.printStackTrace();
}
while(true)
{
List<TeamEvent> events = eventRes.getEvents();
for(int i = 0; i < events.size(); i++)
{
TeamEvent event = events.get(i);
if(event.getEventCategory() == MEMBERS && event.getEventType().tag() == MEMBER_CHANGE_STATUS)
{
if(event.getDetails().getMemberChangeStatusDetailsValue().getNewValue() == ACTIVE){
//Add to the member list.
}
else if(event.getDetails().getMemberChangeStatusDetailsValue().getNewValue() == REMOVED){
//Remove from member list by member ID.
}
}
}
if(eventRes.getHasMore())
{
try
{
eventRes = teamLog.getEventsContinue(eventCursor);
eventCursor = eventRes.getCursor();
}
catch (DbxException e)
{
e.printStackTrace();
}
}
else
{
break;
}
}
}
Is it a right approach? Because sometimes I got REMOVE event to the user but that user did not have a ACTIVE event. Hence, it messes up the member list.
You can certainly monitor the event log for member changes like this. Note that not all members will necessarily become "active" though, so you may see a member "removed" without being "active" first. That can happen if a member account is "invited" and then removed before they actually set up the account. In that case the account would never become "active". You may want to check for "invited" instead of "active".
You can certainly monitor the event log for member changes like this. Note that not all members will necessarily become "active" though, so you may see a member "removed" without being "active" first. That can happen if a member account is "invited" and then removed before they actually set up the account. In that case the account would never become "active". You may want to check for "invited" instead of "active".
Thank you for the information.
Hi there!
If you need more help you can view your support options (expected response time for a 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!