# Manage Google Drive Files

List, upload, download, copy, and share Google Drive files with the typed GoogleDriveClient from OfficeIMO.GoogleWorkspace.Drive.

**Packages**

- [OfficeIMO.GoogleWorkspace.Drive](https://www.nuget.org/packages/OfficeIMO.GoogleWorkspace.Drive) `dotnet add package OfficeIMO.GoogleWorkspace.Drive`
- [OfficeIMO.GoogleWorkspace](https://www.nuget.org/packages/OfficeIMO.GoogleWorkspace) `dotnet add package OfficeIMO.GoogleWorkspace`

**Works with**

- .NET

**Target frameworks**

netstandard2.0, net8.0, net10.0, net472

**APIs**

- [`GoogleDriveClient`](/api/google-workspace-drive/officeimo-googleworkspace-drive-googledriveclient/)
- [`GoogleDriveClientOptions`](/api/google-workspace-drive/officeimo-googleworkspace-drive-googledriveclientoptions/)
- [`GoogleDriveFile`](/api/google-workspace-drive/officeimo-googleworkspace-drive-googledrivefile/)
- [`GoogleServiceAccountCredentialSource`](/api/google-workspace/officeimo-googleworkspace-googleserviceaccountcredentialsource/)
- [`GoogleWorkspaceSession`](/api/google-workspace/officeimo-googleworkspace-googleworkspacesession/)
- [`GoogleDriveFileList`](/api/google-workspace-drive/officeimo-googleworkspace-drive-googledrivefilelist/)
- [`GoogleDriveListOptions`](/api/google-workspace-drive/officeimo-googleworkspace-drive-googledrivelistoptions/)
- [`GoogleDriveUploadOptions`](/api/google-workspace-drive/officeimo-googleworkspace-drive-googledriveuploadoptions/)

**Limits**

Multipart uploads are limited to 5 MiB; use UploadResumableAsync for larger files.

**Verified**

Examples compiled against the source on 2026-11-14

**Data**

- [OfficeIMO.GoogleWorkspace.Drive API index](/api/google-workspace-drive/index.json)
- [OfficeIMO.GoogleWorkspace API index](/api/google-workspace/index.json)

`GoogleDriveClient` is the Drive layer the format translators use, and applications can call it directly. It covers metadata, folders, shared-drive checks, list, copy, move, delete, permissions, comments and replies, revisions, change tokens, export formats, downloads, multipart and resumable uploads, progress, and cancellation.

`GoogleDriveClient.GetRequiredScopes(operation)` returns the default scope family for an operation, and `GoogleDriveClientOptions` can override read and write scopes. A `drive.file` token only sees files the application created or opened; ask for a broader Drive scope only when the product needs it.

## List files in a folder

### C#

```csharp
using OfficeIMO.GoogleWorkspace;
using OfficeIMO.GoogleWorkspace.Drive;

using var credentials = GoogleServiceAccountCredentialSource.FromFile("service-account.json");
var session = new GoogleWorkspaceSession(credentials);

using var drive = new GoogleDriveClient(session);
GoogleDriveFile folder = await drive.ResolveFolderAsync("folder-id");

GoogleDriveFileList files = await drive.ListFilesAsync(new GoogleDriveListOptions {
    DriveId = folder.DriveId,
    Query = $"'{folder.Id}' in parents and trashed = false"
});

foreach (GoogleDriveFile file in files.Files) {
    Console.WriteLine($"{file.Name} ({file.MimeType})");
}
```

## Upload and download a file

### C#

```csharp
using OfficeIMO.GoogleWorkspace;
using OfficeIMO.GoogleWorkspace.Drive;

using var credentials = GoogleServiceAccountCredentialSource.FromFile("service-account.json");
var session = new GoogleWorkspaceSession(credentials);
using var drive = new GoogleDriveClient(session);

GoogleDriveFile uploaded = await drive.UploadMultipartAsync(
    File.ReadAllBytes("report.pdf"),
    new GoogleDriveUploadOptions {
        Name = "report.pdf",
        ContentType = "application/pdf",
        ParentId = "folder-id"
    });

byte[] content = await drive.DownloadAsync(uploaded.Id!);
File.WriteAllBytes("report-copy.pdf", content);
```

<!-- PowerForge markdown artifact sha256:65DC2B6CFF1DBB91DD0D5F886C197867381D819FEBC0C79ACC7CEE5AB11CC560 -->
