cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

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: 

Problem with copy folder api in c#

Problem with copy folder api in c#

Pierluigi2019
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

Re: Problem with copy folder api in c#

Greg-DB
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.

Re: Problem with copy folder api in c#

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

Re: Problem with copy folder api in c#

Greg-DB
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.

Re: Problem with copy folder api in c#

Pierluigi2019
Helpful | Level 6

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

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Pierluigi2019 Helpful | Level 6
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?