Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

tritnguyen's avatar
tritnguyen
Explorer | Level 3
4 years ago
Solved

How to get the admin memberID

Hi All, I want to keep track of the admin team member ID of the person who invite or remove the new user for the team. If I got the event and I can print it as:   { "timestamp" : "2022-11-03...
  • Greg-DB's avatar
    4 years ago

    The actor won't necessarily be an admin. For example, if the operation was performed via the API, it will be an app instead. If you attempt to get the actor information as an admin when it wasn't an admin, you'll get that error. You should check the actor type before accessing it as that type to avoid that.

     

    Also, you would need to cast the UserLogInfo for the admin actor as TeamMemberLogInfo to get the team member ID.

     

    Here's a small sample that shows how to do both of these:

    if (event.getActor().isAdmin()) {
        String adminAccountId = event.getActor().getAdminValue().getAccountId();
        System.out.println(adminAccountId);
        String adminTeamMemberId = ((TeamMemberLogInfo)event.getActor().getAdminValue()).getTeamMemberId();
        System.out.println(adminTeamMemberId);
    } else if (event.getActor().isApp()) {
        String appId = event.getActor().getAppValue().getAppId();
        System.out.println(appId);
    } // and so on; check and handle other types...

     

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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, Facebook or Instagram.

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!