# Work with Google Shared Drives

Point exports at a shared drive and folder, check that the folder belongs to that drive, and track changes per shared drive.

**Packages**

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

**Works with**

- .NET

**Target frameworks**

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

**APIs**

- [`GoogleDriveFileLocation`](/api/google-workspace/officeimo-googleworkspace-googledrivefilelocation/)
- [`GoogleDriveClient`](/api/google-workspace-drive/officeimo-googleworkspace-drive-googledriveclient/)
- [`GoogleDriveFile`](/api/google-workspace-drive/officeimo-googleworkspace-drive-googledrivefile/)
- [`GoogleServiceAccountCredentialSource`](/api/google-workspace/officeimo-googleworkspace-googleserviceaccountcredentialsource/)
- [`GoogleSharedDrive`](/api/google-workspace-drive/officeimo-googleworkspace-drive-googleshareddrive/)
- [`GoogleWorkspaceSession`](/api/google-workspace/officeimo-googleworkspace-googleworkspacesession/)
- [`GoogleWorkspaceSessionOptions`](/api/google-workspace/officeimo-googleworkspace-googleworkspacesessionoptions/)

**Verified**

Examples compiled against the source on 2026-11-14

**Data**

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

When a workflow writes to a shared drive, set both the drive and the folder. The folder is the real placement boundary; a query flag alone does not prove the folder belongs to the intended drive. All translators resolve `GoogleDriveFileLocation` against the session defaults, and you can override `DriveId` and `FolderId` per operation.

## Check a shared drive and folder

### C#

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

using var credentials = GoogleServiceAccountCredentialSource.FromFile("service-account.json");
var session = new GoogleWorkspaceSession(credentials, new GoogleWorkspaceSessionOptions {
    DefaultDriveId = "shared-drive-id",
    DefaultFolderId = "shared-drive-folder-id"
});

using var drive = new GoogleDriveClient(session);
GoogleSharedDrive sharedDrive = await drive.GetSharedDriveAsync(session.Options.DefaultDriveId!);

// Throws when the folder is not a folder or is not in the expected shared drive.
GoogleDriveFile folder = await drive.ResolveFolderAsync(
    session.Options.DefaultFolderId!,
    session.Options.DefaultDriveId);

Console.WriteLine($"{sharedDrive.Name}: {folder.Name}");
```

## Track changes per shared drive

`OfficeIMO.GoogleWorkspace.Sync` keeps a separate change cursor for the user feed and for each configured shared drive, so a failure on one drive does not move another drive's checkpoint. See [Track Google Drive Changes](/docs/google-workspace/sync/).

<!-- PowerForge markdown source sha256:149F99A0EDA10780F0ACD7639738913F1B612216B0934EBCE3DE7F75ED58D3E1; title=True -->

<!-- PowerForge markdown artifact sha256:C41B4CE231FA228A656B141113BDC9E2FA4158382284A40405B0F78D2B2FFBB8 -->
