folder.getOwner does not return the correct value / Google Script

Viewed 39

my google script code isn't returning the name of the creator for "folder.getOwner" I am getting this:

function () { [native code] }

The exact same is happening for "folder.getDescription"

The code is supposed to get the data from a folder path and insert the data in a google sheet such as the person who created it, description, date, etc. This is the output I am getting on google sheet: 02 Banking Insurance -> Fintech -> Customer01 -> function () { [native code] } -> function () { [native code] } -> function () { [native code] } -> 11/7/2020 2:24:12

I do not know why, can someone help?

function addRowToSheetForFolder(folder) {
  var FolderBanking = DriveApp.getFolderById("FolderID");
  data = [
             
             FolderBanking, //Parent folder
             folder.getName(),
             folder.getName().toString(),
             folder.getDateCreated,
             folder.getDescription,
             folder.getOwner,
             //editors.toString(), // find out how to add the editor
             //viewers.toString(),
             folder.getDateCreated(),
            // folder.getSize(),
             folder.getUrl(),
             "https://docs.google.com/uc?export=download&confirm=no_antivirus&id=" + folder.getId(),
             folder.getDescription(),
             folder.getMimeType,
         ];
  Logger.log("Writing row to sheet");
  var sheet = SpreadsheetApp.getActiveSheet();
  sheet.appendRow(data);

EDIT: It is not possible to retrieve the creator from a folder in the shared drive it only works on MyDrive -> getOwner() will always retrieve null

0 Answers
Related