I’ve got a working app that saves a document into a user-specified folder in their collection.
This works fine except when they want to save into their root folder.
According to the docs,
function testGetRoot() {
var root = DocsList.getRootFolder();
var folderName = DocsList.getFolderById(rootid);
Logger.log("Folder name: " + folderName.getName());
}
folderName shows ‘Root’ as the getName for the root of my collection.
So, seeing that I added ‘Root’ to the ListBox that is populated by the names of the other folders in my collection. That of course, was too easy..
**var collectionFolder = DocsList.getFolder(selectedCollection)**;
I get a ‘cannot find folder Root’ error message.
So I can get the Name of the root, but can’t seem to get it to be accepted by getFolder method.
What am I missing?
You’re not missing anything. You should report this issue in the issue tracker, as it makes sense. But as a alternative, which I’d probably use even if this worked, is referencing always to the folder id. e.g.