title: Creating files in specific folders in Drive using App Script
body: <p>I am trying to create a Google Document (and would be useful for any other type of file) in a specific folder in Drive. I have consulted previous questions here on stack overflow, but cannot get my results. I have tried two different ways:</p>
  
  <pre><code>function createDoc(){
  
    var destFolder = DriveApp.getFolderById('1SsLunZh5sn5HDGkcCcTBoXkvDdc70J4g');
    var resource = {
      title: "New Test Doc",
      mimeType: MimeType.GOOGLE_DOCS,
      parents: [{ id: destFolder }]
    }
  
    Logger.log(destFolder);
  
    var fileJson = Drive.Files.insert(resource);
    var fileId = fileJson.id;
  
    Logger.log(fileId);
  
  }
  </code></pre>
  
  <p>I've got the Advanced Drive API activated, but I get an error message stating:</p>
  
  <p>GoogleJsonResponseException: API call to drive.files.insert failed with error: File not found: Udemy GAS Complete Course (line 25, file "Code")</p>
  
  <p>I've also tried this:</p>
  
  <pre><code>function createDoc2(){
  
    var destFolder = DriveApp.getFolderById('1SsLunZh5sn5HDGkcCcTBoXkvDdc70J4g');
    var newDoc = DriveApp.createFile("New Test Doc", "", MimeType.GOOGLE_DOCS);
  
  }
  </code></pre>
  
  <p>But I get an error stating:
  Exception: Invalid argument: file.contentType (line 35, file "Code")</p>
  
  <p>Would very much appreciate some insight. Thanks in advance</p>