cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted

Problem with copy folder api in c#

Helpful | Level 6

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?





4 Replies 4
Highlighted

Re: Problem with copy folder api in c#

Dropboxer
Dropboxer

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.

Highlighted

Re: Problem with copy folder api in c#

Helpful | Level 6

All my folders are shared folders.
The problem is:
when I use this line of code

await 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?

Highlighted

Re: Problem with copy folder api in c#

Dropboxer
Dropboxer

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.

Highlighted

Re: Problem with copy folder api in c#

Helpful | Level 6

I did like you described and everything works.
Thanks for your help.

Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?