title: Take ownership of other users Drive-files using Google Apps Script
body: <pre><code>Intro
  </code></pre>
  
  <p>I'm tasked with creating a shared Google Drive folder-structure for my company.
  I want everything in (or parts of) it to be owned by the same user.
  To do this, I want to use Google Apps Script to force ownership of all files/folder within a folder, for a list of folders.</p>
  
  <pre><code>Problem 
  </code></pre>
  
  <p>I cant get the ownership-transfer to work.</p>
  
  <pre><code>Thoughts
  </code></pre>
  
  <p>Google Apps Admins can force ownership from user X to user Y. But that wont do since I only want files places in the shared folder to have ownership transferred. </p>
  
  <p>Previously it could be done by Apps Script, with a third party function called <a href="https://sites.google.com/site/scriptsexamples/new-connectors-to-google-services/driveservice" rel="nofollow">transferOwnership</a>. </p>
  
  <p>In the  <a href="https://developers.google.com/apps-script/reference/drive/file#setOwner%28User%29" rel="nofollow">current implementation of Apps Script</a> I get "Access Denied".
  If the setOwner-function only can be used by the file owner, it is useless to me, but if the error is from something else, I'd like to know what. </p>
  
  <p>I am full admin and I rather use the "real" function-library then a third party.</p>