Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
itsrainman
8 years agoExplorer | Level 3
Share a folder with team members using dropbox api v2.0
Hello, I am trying to create an app that will run on a internal remote server. The app 'listens' for XML files being generated by our BMS system and then processes these as required. The next...
Greg-DB
Dropbox Community Moderator
8 years agoTo share a folder using the .NET SDK, you should use the ShareFolderAsync method. Then, you can use the AddFolderMemberAsync method to invite users to it, e.g., by specifying their email in a MemberSelector.Email in an AddMember.
I'm afraid I don't have sample code for this, but you would use the same dbx client, and access these methods in dbx.Sharing. The documentation linked above covers the expected parameters/types.
itsrainman
8 years agoExplorer | Level 3
Many thanks for the response. I have looked and coded these but without the actual code that fits within the functions or an example thereof I'm at a loss. I think I understand the function characteristics but not how to call them.
So If we used the example, I would pass the function the folder detail, the members to share with etc. But how this is a processed is what I'm at a loss of.
Thanks
- Greg-DB8 years ago
Dropbox Community Moderator
Calling these functions would work the same way as the ones you already have, e.g., calling ShareFolderAsync would look like:
Await dbx.Sharing.ShareFolderAsync(path)
Please give that a try. If you run in to any issues writing it, post what you have and the details of what you're stuck on (e.g., the error message, etc.)
- itsrainman8 years agoExplorer | Level 3
Hello Greg,
Many thanks for taking the time to respond. I've been on other stuff and have only managed to get back to this today.
So i used your suggestion.
Await dbx.Sharing.ShareFolderAsync(path)
Replacing path with my folder strFolder (/TempFolder)
Await dbx.Sharing.ShareFolderAsync(strFolder)
As soon as I tested the code it appered in my dropbox information bubble on the taskbar - great.
Now how do i send other users a link to enable them to share this folder. I assume it something along the lines of:
Await dbx.Sharing.AddFolderMemberAsync(strFolder, "someemail@email.com")
However when i get this there is an error with the message below.
System.AggregateException
HResult=0x80131500
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at ....
Inner Exception 1:
InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Collections.Generic.IEnumerable`1[Dropbox.Api.Sharing.AddMember]'.I think its because its not possible to convert the email address which is a string to an iEnumerable(of AddMember).
How do i create a list of email addresses to send the share link to?
- Greg-DB8 years ago
Dropbox Community Moderator
I just dug up this old post where I wrote an example of using MemberSelector and AddMember to specify a member to add via an email address:
https://www.dropboxforum.com/t5/API-Support-Feedback/How-we-share-folder-and-file-via-dropbox-api/m-p/194299/highlight/true#M8768
It also shows how to check the shared folder job, since you need to supply the shared folder ID, not path, when adding a member. Hope this helps!
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!