7

We have a google corporate account and need to transfer ALL of a user's google drive files to another account in certain instances. We want to do what is described at the following link for "all files" but programatically via the latest Drive API http://support.google.com/a/bin/answer.py?hl=en&answer=1247799

We are currently using the following API version(s) below, coupled with domain wide authority delegation as described at https://developers.google.com/drive/delegation and are able to see a user's files, iterate over them etc.

  • google-api-services-drive 1.14.2-beta
  • google-api-client 1.14.1-beta

My question is this: it appears that the only way to change permissions is by fileId by fileId etc. Instead of having to traverse and iterate over an entire set of user's files, if we just want to transfer ALL of a user's files to another particular user: is there a way in the API to do this (ownership transfer for ALL files) rather than individual requests file/by file?

Also when transferring ownershisp, must the transferee be in the same @domain or can it be another @domain we manage? I read somewhere that you can only transfer to owners in the same domain. Does this still hold true? For instance we manage @myCompany.com and have our corporate account registered under that, however that shell account has several sub-domains within it. We would like to transfer files from users in the sub-domains to a central user in the @myCompany domain.

RichVel
  • 7,030
  • 6
  • 32
  • 48
nebulize
  • 93
  • 1
  • 1
  • 4

4 Answers4

6

You need to change permissions file by file, there is no updateAll type of functionality at the moment.

You cant transfer the ownership to another domain's user. Ownership can only be transferred to another user in the same domain as the current owner.

Burcu Dogan
  • 9,153
  • 4
  • 34
  • 34
  • 1
    The above is partially correct. (A) yes you have to do this file by file, however (B) does not seem to be true, for domains under our corporate account, our code is able to transfer ownership of files from user1@mydomain1.com to user2@mydomain2.com just fine. – nebulize May 08 '13 at 17:39
4

This answer doesn't directly answer your question, but it could be helpful for both you and future visitors.

As of now, you can mass transfer files to new users with Google's new Admin console. It doesn't let you filter for specific folders, but it does allow you to transfer all of one user's Drive files to a second user.

I know you were trying to create something which uses the API to iterate through folders and files, and you probably have a very specific use-case in mind. However, in the case where you have employees leaving, or you need to transfer everything, using the following method is fast and simple.

  1. Open the Google Admin console
  2. Go to Google Apps > Drive
  3. Click on "Transfer ownership"
  4. Fill out both user fields and submit

This process will even email both users once the process is completed.

VictorKilo
  • 1,839
  • 3
  • 24
  • 39
  • Sorry @Totty. They updated the UI a few months back and it changed. My answer has been updated to reflect those changes. – VictorKilo Sep 08 '14 at 23:09
  • NB: This solution applies only to (corporate) [Google Apps](https://www.google.com/work/apps/business/) users (which the OP is). – j08lue Jun 18 '15 at 13:06
  • The problem with this solution is that it takes all of the files out of their file structure and puts them into a new folder. It is not a workable solution when you have to print lists of hundreds of files to put them back in place – Ramon Suarez Oct 19 '15 at 15:09
  • @RamonSuarez I'm not sure that's the case Ramon, unless something has changed since September 2nd, 2015. Sept 2nd is the last time that I transferred a user's drive folder -- the folder structure was left in the same state that it was prior to the transfer. – VictorKilo Oct 19 '15 at 20:17
0

You can do this with a single call to the Data Transfer API

Jay Lee
  • 13,415
  • 3
  • 28
  • 59
-3

Exactly what is needed but only with API!

  1. Open the Google Admin console
  2. Go to Google Apps > Drive
  3. Click on "Transfer ownership"
  4. Fill out both user fields and submit
  5. This process will even email both users once the process is completed.

If this is not possible via API calls, then there is no point deleting a user using API.

Hawken MacKay Rives
  • 1,171
  • 1
  • 16
  • 26
Idan
  • 1