# GoogleWorkspaceSession

Represents a configured Google Workspace session used by exporter packages.

Class 

`OfficeIMO.GoogleWorkspace`

**Namespace**

`OfficeIMO.GoogleWorkspace`

**Assembly**

`OfficeIMO.GoogleWorkspace`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[GoogleWorkspaceSession.cs:6](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace/GoogleWorkspaceSession.cs#L6)

**Modifiers**

sealed

Represents a configured Google Workspace session used by exporter packages.

## Inheritance

- object
- GoogleWorkspaceSession

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Authenticate to Google Workspace](/docs/google-workspace/authentication/) Guide
  
  Create a GoogleWorkspaceSession in .NET from a service account, a short-lived access token, or existing Google APIs credentials.
- [Export Office Documents to Google Workspace](/docs/google-workspace/) Guide
  
  Export Word, Excel, and PowerPoint documents to Google Docs, Sheets, and Slides, import them back, and work with Drive through one shared session.
- [Export and Import Google Docs](/docs/google-workspace/docs/) Guide
  
  Plan a Word-to-Google-Docs export offline, create a Google Doc from a WordDocument, import a Google Doc, and replace an existing one safely.
- [Export and Import Google Sheets](/docs/google-workspace/sheets/) Guide
  
  Plan an Excel-to-Google-Sheets export offline, create a spreadsheet from an ExcelDocument, import a Google Sheet, and replace an existing one safely.
- [Export and Import Google Slides](/docs/google-workspace/slides/) Guide
  
  Plan a PowerPoint-to-Google-Slides export, create a presentation from a PowerPointDocument, and import or replace Google Slides safely.
- [Manage Google Drive Files](/docs/google-workspace/drive/) Guide
  
  List, upload, download, copy, and share Google Drive files with the typed GoogleDriveClient from OfficeIMO.GoogleWorkspace.Drive.

## Usage

Explore 2 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Accepted by parameters 2

- Method [GoogleWorkspaceFailureDiagnostics.CreateTokenAcquisitionFailure](/api/google-workspace/officeimo-googleworkspace-googleworkspacefailurediagnostics/#method-createtokenacquisitionfailure-string-collections-generic-ireadonlylist-system-string-officeimo-googleworkspace-googleworkspacesession-officeimo-googleworkspace-translationreport-exception) parameter `session`
- Constructor [GoogleWorkspaceHttpTransport.GoogleWorkspaceHttpTransport](/api/google-workspace/officeimo-googleworkspace-googleworkspacehttptransport/#constructor-ctor-officeimo-googleworkspace-googleworkspacesession) parameter `session`

Filter members 

Show inherited

## Constructors

`public GoogleWorkspaceSession(IGoogleWorkspaceCredentialSource credentialSource, GoogleWorkspaceSessionOptions? options = null)` [#](#constructor-ctor-officeimo-googleworkspace-igoogleworkspacecredentialsource-officeimo-googleworkspace-googleworkspacesessionoptions)

[GoogleWorkspaceSession.cs:6](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace/GoogleWorkspaceSession.cs#L6)

Creates a session from a credential source and optional transport and policy settings.

Parameters

**credentialSource OfficeIMO.GoogleWorkspace.IGoogleWorkspaceCredentialSource required**

Source used to acquire scoped Google OAuth tokens.

**options OfficeIMO.GoogleWorkspace.GoogleWorkspaceSessionOptions? = null optional**

Session settings, or null to use defaults.

## Methods

`public async Task<GoogleWorkspaceAccessToken> AcquireAccessTokenAsync(IEnumerable<string> scopes, CancellationToken cancellationToken = default)` [#](#method-acquireaccesstokenasync-collections-generic-ienumerable-system-string-threading-cancellationtoken)

Acquires and validates a token for every requested scope and the configured expected account.

Parameters

**scopes System.Collections.Generic.IEnumerable<string> required**

OAuth scopes required by the operation. Blank and duplicate entries are removed.

**cancellationToken System.Threading.CancellationToken = default optional**

Token used to cancel acquisition.

Returns

`Task<GoogleWorkspaceAccessToken>` A nonexpired token whose bound scopes cover the normalized request.

Exceptions

- `InvalidOperationException` – The credential source returns no token, an expired token, insufficient scopes, or identity evidence that does not match the session policy.

`public GoogleDriveFileLocation ResolveLocationDefaults(GoogleDriveFileLocation? location)` [#](#method-resolvelocationdefaults-officeimo-googleworkspace-googledrivefilelocation)

[GoogleWorkspaceSession.cs:27](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace/GoogleWorkspaceSession.cs#L27)

Combines an operation-specific Drive location with the session defaults.

Parameters

**location OfficeIMO.GoogleWorkspace.GoogleDriveFileLocation? required**

Location supplied by the operation, or null to use all defaults.

Returns

`GoogleDriveFileLocation` A new location instance; the supplied instance is not modified.

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public IGoogleWorkspaceCredentialSource CredentialSource { get; }` [#](#property-credentialsource)

[GoogleWorkspaceSession.cs:19](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace/GoogleWorkspaceSession.cs#L19)

Gets the credential source used by this session.

`public GoogleWorkspaceSessionOptions Options { get; }` [#](#property-options)

[GoogleWorkspaceSession.cs:21](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace/GoogleWorkspaceSession.cs#L21)

Gets the transport, retry, identity, and operation-policy settings.

<!-- PowerForge markdown artifact sha256:4A40B4C2536C9E8F5AB29983BAA53BABC096451D7184BFF4B9FDC91063C72CA5 -->
