Transfer ownership of a file to a user outside my organisation in Google App Script

355 views Asked by At

I would like to change the owner of a file in google apps script. I tried following code:

function changeOwner() {
  
  var file = DriveApp.getFileById("id");
  file.setOwner("[email protected]");
  
}

It generate an exception error: Argument is not valid. [email protected] is not a member of my organisation.

Could you help me to transfer ownership to a user outside my organisation?

1

There are 1 answers

2
ziganotschka On

You are not allowed to transfer ownership of a file on your personal Drive to a user outside of your organization

If you try - you will receive the aforementioned error:

Exception: Invalid argument