Question

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.

Était-ce utile?

La solution

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.

Autres conseils

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.

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

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top