We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Filip J.1
10 years agoNew member | Level 1
Get Account Id from UserInfoMembership using Team Client .NET
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
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
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.110 years agoNew 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-DB10 years ago
Dropbox Community Moderator
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.110 years agoNew 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-DB10 years ago
Dropbox Community Moderator
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.110 years agoNew member | Level 1
So there is no team endpoint that allows you to get account information without using AsMember?
- Greg-DB10 years ago
Dropbox Community Moderator
That's correct. (For reference, TeamRoutes contains all of the team endpoints.)
About 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!