One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
Pierluigi2019
6 years agoHelpful | Level 6
Problem with copy folder api in c#
I have created a team folder structure with subfolder levels and I create these folders with the dropbox api.
Structure
Folder Level 1: Companies
Folder Level 2: Customers
Folder level 3: Projects
For every level folders I set specific users permissions.
Now I would like to copy a Project folder with all files and insert it in the same Customer Folder with a specific folder name and specific users that I should set.
When I use
await dropbox.Files.CopyV2Async(originFolder, destinationFolder, true, true, true)
, it will copy the full folder but the users are the same of the origin folder.
I use the method
await dropbox.Files.GetMetadataAsync(folder)
to retrieve the share folder Id but in this scenario it is Null.
Without share folder Id I cannot insert or remove users from this new folder.
What am i doing wrong?
- Greg-DB
Dropbox Staff
I'm not sure I fully understand your question, so if not, please share some more specific details as an example so I can review it better. You can share privately here if you prefer.
From your description though, note that if the result of GetMetadataAsync doesn't have FolderSharingInfo.SharedFolderId set, it means that the folder itself is not a shared folder. Consequently, you can't add users to it directly. It sounds like it's underneath another shared folder though, in which case it would inherit its sharing properties from the shared parent folder, and FolderSharingInfo.ParentSharedFolderId would be set to the shared folder ID of the shared parent folder.
- Pierluigi2019Helpful | Level 6
All my folders are shared folders.
The problem is:
when I use this line of codeawait dropbox.Files.CopyV2Async(originFolder, destinationFolder, true, true, true)
I expect that the destination folder (if not exists) will be created like "shared folder" and then I should add the users, but it isn't.
It happens exactly like you described.
"sharing properties from the shared parent folder, and FolderSharingInfo.ParentSharedFolderId would be set to the shared folder ID of the shared parent folder."
My question is how I should copy a folder where the "destination folder" will be like a new shared one with only me like user?- Greg-DB
Dropbox Staff
I see, thanks for clarifying.
When you make a copy of a folder, such as by using CopyV2Async, you're only making a distinct copy of the folder and its contents; it does not copy over the sharing properties of the original.
The resulting copy of the folder will inherit the sharing properties of its shared parent, if any. Or, if you want to share the copy itself, you will then need to call ShareFolderAsync to share the new copy, and AddFolderMemberAsync to add members, as desired.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,940 PostsLatest Activity: 23 hours ago
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 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!