DriveApp.getFoldersByName give different result depending on user

Viewed 51

I have a script that copies folders and content. It gets the folder names to copy from a sheet. All this works. When the script comes to

DriveApp.getFoldersByName("NameOfFolder"); 

The script finds the folder iterator when I execute the script, but not when my colleague does. If he does a search in Drive he can see the folder, the script returns null. We have the same access to the folder. Its a shared folder on Google Drive.

Can anyone explain?

Here is the code that reproduces the error:

NB: the sheet supplies the script with propper names of folders to look for.

function shortTest() {
var episodeFolderList = DriveApp.getFoldersByName("Folder name");
var episodeFolderByID = DriveApp.getFolderById("longFolderIDXXXXXXX");
Logger.log(episodeFolderByID+"-By ID")
var episodeFolder=episodeFolderList.next();
Logger.log (episodeFolder+ " -by name")

}

Ill ask him to log out of other accounts and try again. Thank you for all the input.

0 Answers
Related