<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get the admin memberID in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/634032#M29258</link>
    <description>&lt;P&gt;I am sorry that I made a mistake when I did a copy and paste. It works OK now.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2022 20:26:47 GMT</pubDate>
    <dc:creator>tritnguyen</dc:creator>
    <dc:date>2022-11-03T20:26:47Z</dc:date>
    <item>
      <title>How to get the admin memberID</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/633997#M29253</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hi All,&lt;/P&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{&lt;BR /&gt;"timestamp" : "2022-11-03T17:17:51Z",&lt;BR /&gt;"event_category" : "members",&lt;BR /&gt;"event_type" : {&lt;BR /&gt;".tag" : "member_change_status",&lt;BR /&gt;"description" : "Changed member status (invited, joined, suspended, etc.)"&lt;BR /&gt;},&lt;BR /&gt;"details" : {&lt;BR /&gt;".tag" : "member_change_status_details",&lt;BR /&gt;"new_value" : "invited",&lt;BR /&gt;"previous_value" : "not_joined"&lt;BR /&gt;},&lt;BR /&gt;"actor" : {&lt;BR /&gt;".tag" : "admin",&lt;BR /&gt;"admin" : {&lt;BR /&gt;".tag" : "team_member",&lt;BR /&gt;"account_id" : "admin_account_idxxxxxxxxxxxxxxxxx",&lt;BR /&gt;"display_name" : "TestAdmin",&lt;BR /&gt;"email" : "testAdmin@test.com",&lt;BR /&gt;"team_member_id" : "admin_team_member_idxxxxxxxxxxxxx"&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"origin" : {&lt;BR /&gt;"access_method" : {&lt;BR /&gt;".tag" : "end_user",&lt;BR /&gt;"end_user" : {&lt;BR /&gt;".tag" : "web",&lt;BR /&gt;"session_id" : "session_idxxxxxxxxxxxxxxxxxxxxxxxxxxxx"&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"geo_location" : {&lt;BR /&gt;"ip_address" : "0.0.0.",&lt;BR /&gt;"city" : "",&lt;BR /&gt;"region" : "",&lt;BR /&gt;"country" : ""&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"involve_non_team_member" : false,&lt;BR /&gt;"context" : {&lt;BR /&gt;".tag" : "team_member",&lt;BR /&gt;".tag" : "team_member",&lt;BR /&gt;"account_id" : "team_member_account_idxxxxxxxxxxxxxxxxxxx",&lt;BR /&gt;"display_name" : "",&lt;BR /&gt;"email" : "testTeamMember@test.com",&lt;BR /&gt;"team_member_id" : "team_team_member_idxxxxxxxxxxxxxxxxxxxxxxx"&lt;BR /&gt;},&lt;BR /&gt;"participants" : [ ],&lt;BR /&gt;"assets" : [ ]&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I want to get the team_member_id of the admin which is the value: "admin_team_member_idxxxxxxxxxxxxx". However when I tried to get to the Actor object using the function call:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TeamEvent event = events.get(i);&lt;BR /&gt;String adminTeamMemberId = event.getActor().getAdminValue().....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got the error:&lt;/P&gt;
&lt;P&gt;Exception in thread "main" java.lang.IllegalStateException: Invalid tag: required Tag.ADMIN, but was Tag.APP&lt;BR /&gt;at com.dropbox.core.v2.teamlog.ActorLogInfo.getAdminValue(ActorLogInfo.java:241)&lt;BR /&gt;&lt;BR /&gt;In addition, the object that is returned from the event.getActor().getAdminValue() does not have the get method to the the team_member_id value. I would like to get that value. What should I do?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 16:00:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/633997#M29253</guid>
      <dc:creator>tritnguyen</dc:creator>
      <dc:date>2022-11-04T16:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the admin memberID</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/634017#M29255</link>
      <description>&lt;P&gt;The &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v5.4.3/com/dropbox/core/v2/teamlog/ActorLogInfo.html" target="_blank"&gt;actor&lt;/A&gt; 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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you would need to cast the &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v5.4.3/com/dropbox/core/v2/teamlog/UserLogInfo.html" target="_blank"&gt;UserLogInfo&lt;/A&gt; for the admin actor as &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v5.4.3/com/dropbox/core/v2/teamlog/TeamMemberLogInfo.html" target="_blank"&gt;TeamMemberLogInfo&lt;/A&gt; to get the team member ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a small sample that shows how to do both of these:&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;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...&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 19:35:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/634017#M29255</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-11-03T19:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the admin memberID</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/634022#M29256</link>
      <description>&lt;P&gt;I had the sample code in my test as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN&gt;TeamEvent&lt;/SPAN&gt;&amp;gt; &lt;SPAN&gt;events &lt;/SPAN&gt;= eventRes.getEvents();&lt;BR /&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;(&lt;SPAN&gt;int &lt;/SPAN&gt;i = &lt;SPAN&gt;0&lt;/SPAN&gt;; i &amp;lt; &lt;SPAN&gt;events&lt;/SPAN&gt;.size(); i++)&lt;BR /&gt;{&lt;BR /&gt;    &lt;SPAN&gt;TeamEvent event &lt;/SPAN&gt;= &lt;SPAN&gt;events&lt;/SPAN&gt;.get(i);&lt;BR /&gt;    &lt;SPAN&gt;if&lt;/SPAN&gt;(&lt;SPAN&gt;event&lt;/SPAN&gt;.getEventCategory() == &lt;SPAN&gt;MEMBERS &lt;/SPAN&gt;&amp;amp;&amp;amp;&lt;BR /&gt;        &lt;SPAN&gt;event&lt;/SPAN&gt;.getEventType().tag() == &lt;SPAN&gt;MEMBER_CHANGE_STATUS&lt;/SPAN&gt;){&lt;BR /&gt;        &lt;SPAN&gt;if&lt;/SPAN&gt;(&lt;SPAN&gt;event&lt;/SPAN&gt;.getDetails().getMemberChangeStatusDetailsValue().getNewValue() == &lt;SPAN&gt;INVITED&lt;/SPAN&gt;)&lt;BR /&gt;        {&lt;BR /&gt;            &lt;SPAN&gt;if &lt;/SPAN&gt;(&lt;SPAN&gt;event&lt;/SPAN&gt;.getActor().isAdmin()) {&lt;BR /&gt;                &lt;SPAN&gt;String adminAccountId &lt;/SPAN&gt;= &lt;SPAN&gt;event&lt;/SPAN&gt;.getActor().getAdminValue().getAccountId();&lt;BR /&gt;                &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;adminAccountId&lt;/SPAN&gt;);&lt;BR /&gt;                &lt;SPAN&gt;String adminTeamMemberId &lt;/SPAN&gt;= ((&lt;SPAN&gt;TeamMemberLogInfo&lt;/SPAN&gt;)&lt;SPAN&gt;event&lt;/SPAN&gt;.getActor().getAdminValue()).getTeamMemberId();&lt;BR /&gt;                &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"admin teamMemberId: " &lt;/SPAN&gt;+ &lt;SPAN&gt;adminTeamMemberId&lt;/SPAN&gt;);&lt;BR /&gt;            } &lt;BR /&gt;        }&lt;BR /&gt;        }&lt;BR /&gt;        &lt;SPAN&gt;else if&lt;/SPAN&gt;(&lt;SPAN&gt;event&lt;/SPAN&gt;.getDetails().getMemberChangeStatusDetailsValue().getNewValue() == &lt;SPAN&gt;REMOVED&lt;/SPAN&gt;)&lt;BR /&gt;        {&lt;BR /&gt;            &lt;SPAN&gt;if &lt;/SPAN&gt;(&lt;SPAN&gt;event&lt;/SPAN&gt;.getActor().isAdmin()) {&lt;BR /&gt;                &lt;SPAN&gt;String adminAccountId &lt;/SPAN&gt;= &lt;SPAN&gt;event&lt;/SPAN&gt;.getActor().getAdminValue().getAccountId();&lt;BR /&gt;                &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;adminAccountId&lt;/SPAN&gt;);&lt;BR /&gt;                &lt;SPAN&gt;String adminTeamMemberId &lt;/SPAN&gt;= ((&lt;SPAN&gt;TeamMemberLogInfo&lt;/SPAN&gt;)&lt;SPAN&gt;event&lt;/SPAN&gt;.getActor().getAdminValue()).getTeamMemberId();&lt;BR /&gt;                &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"admin teamMemberId: " &lt;/SPAN&gt;+ &lt;SPAN&gt;adminTeamMemberId&lt;/SPAN&gt;);&lt;BR /&gt;            }&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;However, when I tried the code above I got the error:&lt;BR /&gt;&lt;BR /&gt;Exception in thread "main" java.lang.IllegalStateException: Invalid tag: required Tag.MEMBER_CHANGE_STATUS_DETAILS, but was Tag.MEMBER_CHANGE_ADMIN_ROLE_DETAILS&lt;BR /&gt;at com.dropbox.core.v2.teamlog.EventDetails.getMemberChangeStatusDetailsValue(EventDetails.java:15913)&lt;BR /&gt;&lt;BR /&gt;It seems that the check for Admin Role using the function call &lt;SPAN&gt;event&lt;/SPAN&gt;.getActor().isAdmin() does not work.&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2022 19:51:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/634022#M29256</guid>
      <dc:creator>tritnguyen</dc:creator>
      <dc:date>2022-11-03T19:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the admin memberID</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/634032#M29258</link>
      <description>&lt;P&gt;I am sorry that I made a mistake when I did a copy and paste. It works OK now.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 20:26:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/634032#M29258</guid>
      <dc:creator>tritnguyen</dc:creator>
      <dc:date>2022-11-03T20:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the admin memberID</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/634033#M29259</link>
      <description>&lt;P&gt;You seem to have your "else if" attached to the wrong "if" above it, so it's not properly guarded by the ".isMemberChangeStatus" check.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you don't need to check the tag yourself like that. You should use the supplied the methods instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a corrected version that runs successfully for me:&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;List&amp;lt;TeamEvent&amp;gt; events = eventRes.getEvents();
for (int i = 0; i &amp;lt; events.size(); i++) {
    TeamEvent event = events.get(i);
    if (event.getEventCategory() == EventCategory.MEMBERS &amp;amp;&amp;amp;
            event.getEventType().isMemberChangeStatus()) {
        if (event.getDetails().getMemberChangeStatusDetailsValue().getNewValue() == MemberStatus.INVITED) {
            if (event.getActor().isAdmin()) {
                String adminAccountId = event.getActor().getAdminValue().getAccountId();
                System.out.println(adminAccountId);
                String adminTeamMemberId = ((TeamMemberLogInfo) event.getActor().getAdminValue()).getTeamMemberId();
                System.out.println("admin teamMemberId: " + adminTeamMemberId);
            }
        } else if (event.getDetails().getMemberChangeStatusDetailsValue().getNewValue() == MemberStatus.REMOVED) {
            if (event.getActor().isAdmin()) {
                String adminAccountId = event.getActor().getAdminValue().getAccountId();
                System.out.println(adminAccountId);
                String adminTeamMemberId = ((TeamMemberLogInfo) event.getActor().getAdminValue()).getTeamMemberId();
                System.out.println("admin teamMemberId: " + adminTeamMemberId);
            }
        }
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 03 Nov 2022 20:28:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-get-the-admin-memberID/m-p/634033#M29259</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-11-03T20:28:06Z</dc:date>
    </item>
  </channel>
</rss>

