I'm sorry.please tell me。
Attempting to change the owner of the google drive using Google's data transfer api in java
The following code has been combined.
After running it, I received an email from Google saying that the data transfer was successful.
I thought it was a success, but even if I log in with the target user's account and look at the drive,
Data does not appear to have been transferred.
Does anyone know anything wrong?
public static void main(String[]args)throws Exception {
Directory dir=getDirectoryService();
User user1 = dir.users().get("[email protected]").execute();
User user2=dir.users().get("[email protected]").execute();
DataTransfer d=getDataTransferService();
ApplicationsListResponse l=d.applications().list().setMaxResults(100).execute();
Application app = null;
for (Application a:l.getApplications())
{
if(a.getName().equals("Drive and Docs"))
{
ap = a;
}
}
ApplicationDataTransfer applicationdataTransfer=new ApplicationDataTransfer();
applicationdatatransfer.setApplicationId(apl.getId());
com.google.api.services.admin.datatransfer.model.DataTransfer=new com.google.api.services.admin.datransfer.model.DataTransfer();
t.setOldOwnerUserId(user2.getId());
t.setNewOwnerUserId(user1.getId());
t.setApplicationDataTransfers (Arrays.asList(applicationdatatransfer)));
com.google.api.services.admin.datatransfer.model.DataTransfer t=null;
tt=d.transfers().insert(t).execute();
System.out.println(tt.getId());
System.out.println("---------------------------");
System.out.println(tt.getEtag());
System.out.println("---------------------------");
System.out.println(tt.getOverallTransferStatusCode());
System.out.println("=======================");
System.out.println("#######################";
com.google.api.services.admin.datatransfer.model.DataTransfersListResponse response=d.transfers().list().execute();
for (com.google.api.services.admin.datatransfer.model.DataTransfertt:response.getDataTransfers())
{
System.out.println(ttt.getId());
System.out.println("---------------------------");
System.out.println(ttt.getEtag());
System.out.println("---------------------------");
System.out.println(ttt.getOverallTransferStatusCode());
System.out.println("=======================");
}
}
I'm sorry, but I solved myself.
I set ApplicationTransferParam and it worked.
ApplicationTransferParamp=new ApplicationTransferParam();
p.setKey("PRIVACY_LEVEL");
p.setValue(Arrays.asList("PRIVATE", "SHARED"));
applicationdatatransfer.setApplicationTransferParams (Arrays.asList(p));
567 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
606 Uncaught (inpromise) Error on Electron: An object could not be cloned
567 Who developed the "avformat-59.dll" that comes with FFmpeg?
884 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.