We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
tcnsdca
6 years agoExplorer | Level 3
.Net API SDK - Best way to connect to a Business Dropbox?
Hi, We are in the process of adding Dropbox support to our application. Basically this is so users have an option to store attachments in Dropbox (user creates a sales order in our app and wants to...
Greg-DB
Dropbox Community Moderator
6 years agoThis error message indicates that the access token you're using is for a "Dropbox Business API" app, which connects to entire Dropbox Business teams, but the method you're trying to use is for specific Dropbox accounts.
If you want any kind of Dropbox account (Business or not) to be able to connect to your app, you should instead register a "Dropbox API" app. That kind of app needs to be authorized by each end-user, at which point the app receives an access token for that user's account and can call methods like GetCurrentAccountAsync without additional configuration.
Alternatively, if you only want to connect Business accounts, you can use your "Dropbox Business API" app registration. That kind of app only need to be authorized by a team admin, at which point the app receives an access token for that entire team. Your app would then need to additionally specify which team member to operate on when making an account-specific call such as GetCurrentAccountAsync. You can do so by first making a DropboxTeamClient object and calling DropboxTeamClient.AsMember with the relevant team member ID to get a DropboxClient for that team member.
- tcnsdca6 years agoExplorer | Level 3
I have been trying to use the AsMember method and it seems to always throw this error when I use it - "Invalid select user id format"
DropboxTeamClient teamClient = new DropboxTeamClient(OAUTHTOKEN);
var results = await teamClient.Team.MembersListAsync();
string memberID = string.Empty;
foreach (var member in results.Members)
{
if (member.Profile.Email.Equals("tcash@mac.com", StringComparison.OrdinalIgnoreCase))
{
memberID = member.Profile.AccountId;
if (memberID.StartsWith("dbid:", StringComparison.OrdinalIgnoreCase))
{
memberID = memberID.Substring(5);
}
break;
}
}var dbx = teamClient.AsMember($"dbmid:{memberID}");
The member ID I get from the member profile is in the format of "dbid:XXXXXX", while the code I have found in the forms seems to want to set it as "dbmid:XXXXXX". I've tried both styles and neither worked.
- Greg-DB6 years ago
Dropbox Community Moderator
The AsMember method expects the "team member ID", which is the ID that starts with "dbmid:". Dropbox supplies these values directly, and you should not attempt to modify them.
The team member ID is available as MemberProfile.TeamMemberId (not MemberProfile.AccountId).
- tcnsdca6 years agoExplorer | Level 3
Ok, so I did try using that value and it gave me the same error.
About Discuss Dropbox Developer & API
Make connections with 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!