Cannot Change File Owner Through Google Drive API for Files Created via Desktop Client

I’m having trouble changing ownership of Google Drive files using the API. When I try to transfer ownership of files that were uploaded through the Google Drive desktop app, I get a 403 Insufficient permissions error. However, files created directly in the web interface work perfectly fine.

I’m not using Google Workspace so I can’t use admin features or impersonation. Here’s what I’ve tried so far:

Method 1 - Using Update:

public bool TransferFileOwner(DriveService driveService, string documentId, string currentOwnerId, string newOwnerId)
{
    try
    {
        Permission currentPerm = driveService.Permissions.Get(documentId, currentOwnerId).Execute();
        if (currentPerm.Role == "owner")
        {
            Permission targetPerm = driveService.Permissions.Get(documentId, newOwnerId).Execute();
            targetPerm.Role = "owner";
            PermissionsResource.UpdateRequest updateReq = driveService.Permissions.Update(targetPerm, documentId, newOwnerId);
            updateReq.TransferOwnership = true;
            targetPerm = updateReq.Execute();
        }
    }
    catch
    {
        return false;
    }
    return true;
}

Method 2 - Using Patch:

public bool TransferFileOwner(DriveService driveService, string documentId, string currentOwnerId, string newOwnerId)
{
    try
    {
        Permission currentPerm = driveService.Permissions.Get(documentId, currentOwnerId).Execute();
        if (currentPerm.Role == "owner")
        {
            Permission newPermission = new Permission();
            newPermission.Role = "owner";
            PermissionsResource.PatchRequest patchReq = driveService.Permissions.Patch(newPermission, documentId, newOwnerId);
            patchReq.TransferOwnership = true;
            patchReq.Execute();
        }
    }
    catch
    {
        return false;
    }
    return true;
}

My authorization setup:

static string[] ApiScopes = { DriveService.Scope.Drive };

credentials = GoogleWebAuthorizationBroker.AuthorizeAsync(
    GoogleClientSecrets.Load(_stream).Secrets,
    ApiScopes,
    "user",
    CancellationToken.None,
    new FileDataStore(credentialsPath, true)).Result;

Both methods fail with the same permission error. I’ve also tried using Insert() but that gives me a 400 Bad Request with the message about not being able to change ownership yet.

Has anyone found a workaround for this issue? It seems to be specifically related to files uploaded via the desktop client versus web-created files.

This happens because Google Drive treats desktop uploads differently than web uploads. Desktop files keep stricter permissions from your original system, which blocks API ownership transfers. I’ve found two workarounds that actually work: Move the files to a shared folder where both users can edit, then try the ownership transfer; Have the current owner download and re-upload through the web interface - this resets the permission structure. Timing matters too. I always add a few seconds between changing permissions and attempting the transfer. Success rate jumps way up. Google’s docs don’t mention this quirk, but I’ve seen it happen consistently with desktop-uploaded files regardless of type.

I faced a similar issue during a previous project. Files created via the desktop app indeed have distinct metadata and permissions, which complicates ownership transfer through the API. A potential solution is to ensure that the new owner has been granted appropriate permissions as a collaborator before attempting the transfer. It’s crucial to add them as an editor, then allow a moment for the changes to propagate before initiating the ownership switch. Additionally, files originating from Office applications may impose restrictions that necessitate manual sharing via the web interface before using the API for ownership changes. This inconsistency can be quite frustrating but is a known behavior of Google Drive.

Those permission issues are classic Google Drive API headaches. I’ve hit this same wall multiple times building automated file management systems.

Here’s the thing - desktop uploads create different permission structures that the API just can’t handle well. Fighting the API limitations is pointless, so I built a workaround using Latenode.

My workflow monitors uploads and handles ownership transfers automatically. It detects desktop files, copies them with proper web permissions, transfers ownership of the copy, then swaps out the original.

No more manual re-uploading through the web interface or dealing with random timing delays. The automation handles all those edge cases and permission delays that make manual API calls so unreliable.

I’ve rolled this out for several enterprise clients needing bulk ownership transfers. Works every time, doesn’t matter where the files came from or what type they are.

Check out Latenode for this kind of Google Drive automation: https://latenode.com