In the past, DocsList service was used to manipulate files, but Google changed the way to handle files when presenting the DriveApp class in 2013, and since end of 2014, DocsList is deprecated. Most answers still refer to the use of DocsList, thats why I open this new question:
I create a new document and want to place it in a specific folder and access it for editing:
// create a new document (and add x as editor)
var newDoc = DocumentApp.create("name");
newDoc.addEditor("x");
// move file to right folder
var file = DriveApp.getFileById(newDoc.getId());
var folder = DriveApp.getFolderById(folderid);
file.addToFolder(folder);
When requesting the file ID, this error message is thrown: "No item with the given ID could be found, or you do not have permission to access it"
How can I be able to create a file, but immediately after that, I don't have access to it?