Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transfer ownership for ALL files in user's google drive - using google-api-java-client and the Drive SDK

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.

like image 936
nebulize Avatar asked May 06 '13 17:05

nebulize


People also ask

How to transfer ownership of a Google Drive account?

However, in the case where you have employees leaving, or you need to transfer everything, using the following method is fast and simple. Open the Google Admin console Go to Google Apps > Drive Click on "Transfer ownership" Fill out both user fields and submit

How do I transfer ownership of a folder to a new user?

If you want to transfer ownership of a folder to a new user, the first step is to enter the admin console. Now that you’re in the admin console, first enter the “apps” section. This will let you access all Google Apps, such as Google Docs and Drive. In the admin console, the “apps” section contains all Google Apps, including Google Docs and Drive.

How to transfer ownership of Google workspace drive and Docs?

From the Admin console Home page, go to Apps Google Workspace Drive and Docs. Click Transfer ownership. Note: You need the Drive service privilege and the Data Transfer privileges to see this option. In the From user field, enter the current owner's username and select the corresponding suggested result.

Is it possible to transfer files from one Google Drive to another?

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.


2 Answers

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.

like image 175
Burcu Dogan Avatar answered Oct 13 '22 17:10

Burcu Dogan


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.

like image 23
VictorKilo Avatar answered Oct 13 '22 19:10

VictorKilo