0

I'm writing code in Python that has the task to suspend user and transfer his data to other user.

Unfortunatelly I discovered that that functionality doesn't work.

Acording to documentation of API https://developers.google.com/admin-sdk/data-transfer/v1/reference/transfers/insert

I created in code object which looks like this in python:

{
    'oldOwnerUserId': 'XXXXXXXXXXXXXXXXXXXXX',
    'newOwnerUserId': 'YYYYYYYYYYYYYYYYYYYYY',
    'applicationDataTransfers': 
    [
       {'applicationId': 'UUUUUUU'}
    ]
}

Where:

  • "XXXXXXXXXXXXXXXXXXXXX" is old user ID
  • "YYYYYYYYYYYYYYYYYYYYY" is new user ID
  • "UUUUUUU" is my Google drive Application ID

then I'm running code:

transfer_service.transfers().insert(body=transfer_data).execute()

While running the script there are no errors. After few seconds I recive email that "Data transfer successful" but when I look into new created directory on Drive I see that it is empty. I tested this several times with the same result.

I'm sure that it isn't problem with:

  1. Credidentials - I'm able to get ID's of users and ID of google drive
  2. Users and drive ID's - I have checked them via web panel in above link

I tried to do the same thing via https://admin.google.com and result is the same. What cause that problem?

Cœur
  • 37,241
  • 25
  • 195
  • 267
wszychtaff
  • 21
  • 2
  • Do you suspend the user before you start the transfer? – danielx May 22 '17 at 18:28
  • I tried today with active and suspended user with the same result. After few seconds operation is done with only empty directory on my drive. – wszychtaff May 23 '17 at 05:23
  • Have you checked what the `transfers.get` request returns for your `dataTransferId`? [Have you tried setting the privacy level?](https://developers.google.com/admin-sdk/data-transfer/v1/parameters) – danielx May 23 '17 at 07:18
  • transfer.get gives me `"overallTransferStatusCode": "completed"` in answer – wszychtaff May 23 '17 at 07:38

1 Answers1

2

After contacting Google they told me to add transfer parameters described on website: https://developers.google.com/admin-sdk/data-transfer/v1/parameters

working object now looks like this:

{
   'oldOwnerUserId': 'XXXXXXXXXXXXXXXXXXXXX',
   'newOwnerUserId': 'YYYYYYYYYYYYYYYYYYYYY',
   'applicationDataTransfers': 
   [
      {
         'applicationId': 'UUUUUUU'
         'applicationTransferParams': 
         [
            {
               'key': 'PRIVACY_LEVEL',
               'value': ['PRIVATE', 'SHARED']
            }
         ]
      }
   ]
}

Acording to my conversation w Google without applicationTransferParams script works but It doesn't know what type of data needs to transfer.

wszychtaff
  • 21
  • 2