Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Gags's avatar
Gags
Helpful | Level 6
3 months ago

GetCurrentAccountAsync API Failing for some Team Members while using Impersonation

Hello Greg-DB​ 

We are using the GetCurrentAccountAsync API to determine whether a team member uses Team Space, and to obtain their RootNamespaceId and HomeNamespaceId values.

Below is the relevant code snippet:

string appkey = ConfigurationManager.AppSettings["DropboxAppKeyBiz"];
string appsecret = ConfigurationManager.AppSettings["DropboxAppSecretBiz"];

DropboxTeamClient teamclient = new DropboxTeamClient(refreshtoken, appkey, appsecret);

if (teammemberid != null)
{
    DropboxClient clientadmin = teamclient.AsAdmin(teammemberid);

    Api.Users.FullAccount acc = await clientadmin.Users.GetCurrentAccountAsync();
    if (acc != null && acc.RootInfo != null)
    {
        rootnamespaceid = acc.RootInfo.RootNamespaceId;
        homenamespaceid = acc.RootInfo.HomeNamespaceId;

        if (acc.RootInfo.IsTeam == true)
        {
            IsTeamSpace = true;
            homepath = acc.RootInfo.AsTeam.HomePath;
        }
        else
        {
            IsTeamSpace = false;
        }
    }
}

We have 14 users in this Dropbox Business team ( 13 team members + 1 team admin ).

Folder listing and namespace retrieval works correctly for the team admin and only one team member.

For the remaining 12 team members, the operation fails at Users.GetCurrentAccountAsync()

Could you please help clarify:

- Why is GetCurrentAccountAsync succeeding for only a few accounts and failing for most of the team members?
- Under what conditions does GetCurrentAccountAsync fail when used via the Business API with teamClient.AsAdmin(teamMemberId)?
- What is the correct supported method to reliably retrieve RootNamespaceId, HomeNamespaceId, Team Space configuration ?

All calls are made via a valid Dropbox Business app using Team Admin impersonation (AsAdmin).
Only the above endpoint is failing for most members; other Team API calls (MembersGetInfo, folder listing for admin, etc.) work correctly.

Thank you,
Gagan

2 Replies

  • Gags's avatar
    Gags
    Helpful | Level 6
    3 months ago

    Greg-DB​,

    We are seeing the error "invalid_select_admin" from the API "GetCurrentAccountAsync" for many team members.

  • DB-Des's avatar
    DB-Des
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    3 months ago

    Hi Gags​ 

    To use the AsAdmin() method, you'll need to supply the team member ID of a team admin. If the member you're specifying is not a team admin, you'll receive error "invalid_select_admin".

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

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!