cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Re: copy team folder to new team folder

copy team folder to new team folder

pacoq
Explorer | Level 3

Hi,

I am trying to copy a team folder to a new team folder but I am getting an error 'from_lookup/not_found/.'

 

Used id:.... format and path, no one works

 

c# api, code:

using (var dbx = new DropboxTeamClient(tokenMemberFile))
{
var memListResult = await dbx.Team.MembersListAsync();
var memId = memListResult.Members.First(x => x.Profile.Email.Equals(adminEmail))
?.Profile.TeamMemberId;

var folders = await dbx.AsAdmin(memId).Files.ListFolderAsync("");

foreach (var entry in folders.Entries)
{
if (entry.Name.Equals(templateName) && entry.IsFolder)
{
template = entry.AsFolder;
break;
}
}

var copyRet = await dbx.AsAdmin(memId).Files
.CopyV2Async(template.Id,
"/new",true); <-- error
7 Replies 7

Greg-DB
Dropbox Staff

In order to process a copy in the member's folder like this, you should use AsMember instead of AsAdmin.

 

(For reference, this is because the /2/files/copy_v2 endpoint uses the "Team Admin" mode for "Dropbox-API-Select-Admin", meaning it can't access the member's private files.)

pacoq
Explorer | Level 3

 

hello, with member works but I get this error 'to/conflict/folder/...

how can I indicate that I want to copy inside the folder ?

thanks

Greg-DB
Dropbox Staff

A 'to/conflict/folder' error indicates that the call failed because there's already a folder at the specified destination path.

 

If you're trying to a copy a folder to the inside of another folder, your destination path needs to include the desired name of the folder copy itself, in addition to any parent components, and not refer to a path that already exists.

 

For example, if you have a folder named "folder", and want to make a copy of it inside another pre-existing folder called "parent", your destination path should be "/parent/folder" (not just "/parent").

pacoq
Explorer | Level 3

so if i need to copy the entire folder to other folder i must go folder by folder?

Greg-DB
Dropbox Staff

I'm not sure I understand your question. Are you referring to the folder's contents? If you copy a folder, it will copy the entirety of the folder's contents, including any subfolders.

pacoq
Explorer | Level 3

yes, i want to copy one team folder  to other team folder

Greg-DB
Dropbox Staff

When copying a folder, if it has subfolders inside it, you do not need to iterate over the subfolders. Copying a folder will copy the entire folder, including any contents, such as sub folders.

Need more support?