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...
tcnsdca
6 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-DB
Dropbox Community Moderator
6 years agoThe 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.
- Greg-DB6 years ago
Dropbox Community Moderator
Can your share your current code for that? I just modified your earlier code and it worked fine for me:
DropboxTeamClient teamClient = new DropboxTeamClient(ACCESS_TOKEN); var results = await teamClient.Team.MembersListAsync(); string memberID = string.Empty; foreach (var member in results.Members) { if (member.Profile.Email.Equals(EMAIL_ADDRESS, StringComparison.OrdinalIgnoreCase)) { memberID = member.Profile.TeamMemberId; break; } } //or use MembersGetInfoAsync to look up a specific member directly var dbx = teamClient.AsMember(memberID); var result = await dbx.Users.GetCurrentAccountAsync();
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!