1
votes

I'm getting

Cannot find method makeCopy(string,Folder)

when I try to make a copy of a file. https://developers.google.com/apps-script/reference/drive/file#makeCopy(String,Folder) clearly states that makeCopy(string,Folder) works fine. I am confused, any help?

1
could you show how you get the "file" object ? that's probably where the issue is actually happening.Serge insas
var copyd = DocsList.getFileById(fileid).makeCopy(values[0][1],DocsList.getFolderById(foldera.getId()));kenyunot

1 Answers

2
votes

In the reference you show the method belongs to the DriveApp service, you are using DocsList service and the latter does not have such a method.

That's why you are getting this message.

Use DriveApp to get your file and it will work.

I would also suggest to make use of the autocompletion feature of the script editor to avoid such problems, it will automatically suggest all the possible methods that apply to the object you are working with, very comfortable ;)

(use control|space to call the autocomplete)