cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

Get Account Id from UserInfoMembership using Team Client .NET

Get Account Id from UserInfoMembership using Team Client .NET

Filip J.1
New member | Level 1

I am using a dropbox admin account and using ListFolderMembersAsync and grabbing the UserMemberShipInfo which returns UserInfo. When I get this data returned some of the accounts have TeamMemberId while some have AccountId.

TeamMemberId is not always returned with this api call. How do I do an api call to get the account information using UserInfo if I am using a TeamClient. If I try to use a regular AccountId instead of TeamMemberId I get an exception stating:

This API function operates on a single Dropbox account, but the OAuth 2 access token you provided is for an entire Dropbox Business team.

So how to I get the account information when the teamMemberid is not always returned with the call and I am using a team client.

 

Basically, how do I get account information when I only have the accountId and am using a TeamClient for an admin account?

 

7 Replies 7

Greg-DB
Dropbox Staff

UserInfo.TeamMemberId is documented as "The team member ID of the shared folder member. Only present if SameTeam is true.", meaning it will only be present if "the user is in the same team as current user." The "current user" here is the user you're making the ListFolderMembersAsync call for. (That is, by setting AsMember on the team client.)

When you say you "try to use a regular AccountId instead of TeamMemberId", where are you supplying the account ID? 

If you just want information about that other user, what you should do is call GetAccountAsync with the account ID you're interested in as the accountId parameter, using a team client with AsMember still set to the same member that you used to call ListFolderMembersAsync in the first place. (If the user for the accountId isn't on the same team, you don't have authorization to make calls on their behalf, using AsMember, anyway.)

If you're still having trouble, please share some code that shows the issue.

Filip J.1
New member | Level 1

If I have a fileMetaData object and grab the fileItem.SharingInfo.ModifiedBy it will return the id of the account that last modified the file.

How do I get the information of this account if I only have the this accountId and no longer have access to the asMember id? 

Greg-DB
Dropbox Staff

The same as the other scenario, if you have an account ID and you want information about that account, you'll need to call GetAccountAsync. That is a user endpoint though, so you do need to use AsMember if you have a team client. What do you mean when you say you "no longer have access to the asMember id" though? Can't you just use the same team client with asMember set that you used to retrieve the file metadata itself?

Filip J.1
New member | Level 1

I could, but I haven't passed it down in my functions and am wondering if I can do without it.

It seems redundant that I need to use memberId to make calls for GetAccountAsync. The function takes in an accountId to search for. Whether I make the call from Team Member A or Team Member B does not affect the output, why force users to have a memberId if the output in this case is not dependent on it? 

Greg-DB
Dropbox Staff

The API call itself is a user endpoint (as opposed to a team endpoint). User endpoints require a user in general, even if it doesn't matter in this particular case.

Filip J.1
New member | Level 1

So there is no team endpoint that allows you to get account information without using AsMember? 

Greg-DB
Dropbox Staff

That's correct. (For reference, TeamRoutes contains all of the team endpoints.)

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Filip J.1 New member | Level 1
What do Dropbox user levels mean?