I'm trying to do what I thought would be a simple operation but I'm having some issues with the Google APIs. I've got two Google Credentials, one from a service account and one Access/Refresh from a user who has authenticated to the application.
The Service Account has the Domain Wide Delegation.
On a Team Drive that the Service Account can access (Templates) I have a doc that I would like to copy to the User's My Drive (root). I have the ID of the folder through:
String userRootId = userCredential.drive().files().get( "root" ).setFields( "id" ).execute().getId();
Which returns the proper identifier. When I use the Service Account to Copy the file, I can make copies in the Team Drive all day. It's when I go to copy it to the user's drive that I get "File not found: $userRootId".
I'm assuming that this stems from the Service Account not being able to access the User's My Drive. How can I make this operation work? Has anyone attempted this?