I am writing a web app that will allow students to click a button to create a set of folders & files in their own drive taken from a spreadsheet. My problem is that for some reason when anyone else clicks on the button in the web app, the folder is always made in my own drive, and never the students!
edit: it recognizes the correct user as the active user but still creates the file in my drive not theirs
I've made apps like this before that copied files (not folders) into the user's Drive, and those work fine, but for some reason this doesn't. Is it because I'm creating a brand new folder instead of copying it? The web apps i'd created before always asked the user for permission to look at their drive & edit folders etc but this one doesn't. I can't figure out what I'm doing wrong. Any ideas?
I even tried setting the ownership to the user but it still gets created in my own drive it's driving me nuts. Is there a way to move a folder into a user's my drive through apps script? I couldn't find it in the documentation.
var sheet = '1kM7GeBubLRDC_L_G0rrlddHARSL59DkmWco6Z72gJAg';
var ss = SpreadsheetApp.openById(sheet).getActiveSheet(); //SPREADSHEET
var netID = Session.getActiveUser();
var title = ss.getRange("D1").getValue();
var mainFolder = DriveApp.createFolder(title);
var mainFolderID = mainFolder.getId();
var portfolio = DriveApp.getFolderById(mainFolderID);
portfolio.setOwner(netID + "@nyu.edu");
Logger.log(getOwner(portfolio));