Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I am surrently using:
Private Shared Sub FileUploadToDropbox(ByVal filePath As String, ByVal fileName As String, ByVal fileSource As String)
Dim dbx = New DropboxClient("<REDACTED>")
Dim fs = New FileStream(fileSource, FileMode.Open, FileAccess.Read)
Dim updated = dbx.Files.UploadAsync((filePath + ("/" + fileName)), WriteMode.Overwrite.Instance, body:=fs)
End Sub
To upload a folder and file.
How can I then share this folder with a specific email addres, I wish to then notifiy that email address that a share has been created for them.
To share a folder with a specific Dropbox account using the .NET SDK, you should use ShareFolder to share the folder (once per folder), and then AddFolderMember to invite member(s) to the folder.
By the way, I redacted it from your post, but for the sake of security, you should disable the access token that you posted. You can do so by revoking access to the app entirely, if the access token is for your account, here, or, you can disable just this access token using the API, e.g., using TokenRevoke.
How do I add a member
members As IEnumerable(Of AddMember),
That would look something like this:
var members = new[] { new AddMember(new MemberSelector.Email("email@example.com")) }; await this.client.Sharing.AddFolderMemberAsync(sharedFolderId, members);
Dim myMembers = New AddMember(New MemberSelector.Email("EMAILADDERESS"), Nothing)
dbx.Sharing.AddFolderMemberAsync((filePath + ("/" + fileName)), myMembers, False, "Docs UPloaded")
Seem to get an error, not sure what to do here:
Error BC30512 Option Strict On disallows implicit conversions from 'AddMember' to 'IEnumerable(Of AddMember)'.
Even casting to 'IEnumerable(Of AddMember)' causes error
Can you help
The 'members' parameter does require a IEnumerable<AddMember>, but it appears you're only supplying a AddMember, not in an IEnumerable.
I'm not a Visual Basic expert, but I believe you can build it like this:
Dim myMembers() as AddMember = {New AddMember(New MemberSelector.Email(emailAddress), Nothing)}
Thanks for that, apologies, I am a newby here, 1 more question, how do I get a folderID, can I quierie it based on folder name?
You can get the shared folder ID from SharedFolderMetadata.SharedFolderId (e.g., from a completed ShareFolder job, or elsewhere, such as from ListFolders/ListFoldersContinue) or from FolderSharingInfo.SharedFolderId in FolderMetadata.SharingInfo (e.g., from ListFolder/ListFolderContinue or GetMetadata).
Are there any examples in the API, have googled this, but not sure how to apply this to code.
Just want FolderID based on folder name if possible.
Dim link = dbx.Sharing.GetFolderMetadataAsync((filePath + ("/" + fileName))) Dim myMembers() As AddMember = {New AddMember(New MemberSelector.Email("EMAILADDRESS"), Nothing)} dbx.Sharing.AddFolderMemberAsync(link.Id.ToString, myMembers, False, "Docs Uploaded")
Get error:
System.ArgumentOutOfRangeException: Value should match pattern '\A(?:[-_0-9a-zA-Z:]+)\z'
In this code, you're just using 'Id'. You need the 'SharedFolderId'. In your code, that should be something like:
link.SharingInfo.SharedFolderId
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
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!