Transfer ownership for ALL files on a GoogleGuogle drive - using google-api-java-client and Drive SDK

We have a corporate google account and you need to transfer ALL google google file files to another account in certain cases. We want to do what is described in the following link for β€œall files”, but programmatically using the latest Drive API http://support.google.com/a/bin/answer.py?hl=en&answer=1247799

We are currently using the following versions of the API, in combination with delegation of domain authority, as described in https://developers.google.com/drive/delegation , and can see user files, iterate over them, etc.

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

My question is this: it seems that the only way to change permissions is fileId using fileId etc. Instead of going through and sorting through the entire set of user files, if we just want to transfer ALL user files to another user: is there a way in the API for this (transferring access rights for ALL files), and not separate file / file requests?

Also, when passing ownerhisp, should it be passed in the same @domain or maybe another @domain that we control? I read somewhere that you can only transfer a domain to the owners. Does it persist? For example, we manage @ myCompany.com and have our corporate account registered under this, however this shell account has several subdomains inside it. We would like to transfer files from users in subdomains to a central user in the @myCompany domain.

+6
source share
4 answers

You need to modify the permissions file by file, there is currently no updateAll function.

You cannot transfer ownership to another domain user. Ownership can be transferred to another user in the same domain as the current owner.

+5
source

This answer does not directly answer your question, but it may be useful both for you and for future visitors.

At this time, you can transfer files to new users using the new Google Admin console. It does not allow you to filter specific folders, but it allows you to transfer all files from one user to a second user.

I know that you tried to create something that uses the API to iterate over folders and files, and you probably have a very specific use case. However, if you have employees leaving or need to transfer everything, using the following method is quick and easy.

  • Open the Google Admin Console
  • Go to Google Apps> Drive
  • Click "Transfer Ownership"
  • Fill in both user fields and submit

This process will even email both users after the process is complete.

+5
source

You can do this with a single call to the data transfer API

0
source

Exactly what you need, but only with the API!

  • Open the Google Admin Console
  • Go to Google Apps> Drive
  • Click "Transfer Ownership"
  • Fill in both user fields and submit
  • This process will even email both users after the process is complete.

If this is not possible using API calls, then it makes no sense to delete the user using the API.

-3
source

Source: https://habr.com/ru/post/944384/


All Articles