GoogleDriveClient
OfficeIMO.GoogleWorkspace.Drive
Dependency-light client for Google Drive metadata, content, collaboration, and change operations.
Inheritance
- object
- GoogleDriveClient
Usage
Explore 1 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 1
Constructors
public GoogleDriveClient(GoogleWorkspaceSession session, GoogleDriveClientOptions? options = null) #Creates a Drive client bound to a Workspace session and a snapshot of client options.
Parameters
- session OfficeIMO.GoogleWorkspace.GoogleWorkspaceSession
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveClientOptions? = null
Methods
public async Task<GoogleDriveFile> CopyFileAsync(string fileId, string? name = null, string? parentId = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Copies a Drive file with an optional new name and parent.
Parameters
- fileId string
- name string? = null
- parentId string? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveFile>public async Task<GoogleDriveComment> CreateCommentAsync(string fileId, string content, string? anchor = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Creates a Drive comment and reports the editor limitation for custom anchors.
Parameters
- fileId string
- content string
- anchor string? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveComment>public async Task<GoogleDriveFile> CreateFolderAsync(string name, string? parentId = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Creates a Drive folder, optionally under a parent folder.
Parameters
- name string
- parentId string? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveFile>public async Task<GoogleDrivePermission> CreatePermissionAsync(string fileId, GoogleDrivePermissionCreateOptions options, TranslationReport? report = null, CancellationToken cancellationToken = default) #Creates a permission for a file or shared drive.
Parameters
- fileId string
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDrivePermissionCreateOptions
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDrivePermission>public async Task<GoogleDriveReply> CreateReplyAsync(string fileId, string commentId, string content, string? action = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Creates a reply or applies an action such as resolving a comment thread.
Parameters
- fileId string
- commentId string
- content string
- action string? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveReply>public async Task DeleteCommentAsync(string fileId, string commentId, TranslationReport? report = null, CancellationToken cancellationToken = default) #Deletes a Drive comment thread from a file.
Parameters
- fileId string
- commentId string
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Taskpublic async Task DeleteFileAsync(string fileId, TranslationReport? report = null, CancellationToken cancellationToken = default) #Permanently deletes a Drive file using guarded mutation policy.
Parameters
- fileId string
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Taskpublic async Task DeletePermissionAsync(string fileId, string permissionId, TranslationReport? report = null, CancellationToken cancellationToken = default) #Deletes a permission from a file or shared drive.
Parameters
- fileId string
- permissionId string
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Taskpublic async Task DeleteReplyAsync(string fileId, string commentId, string replyId, TranslationReport? report = null, CancellationToken cancellationToken = default) #Deletes a reply from a Drive comment thread.
Parameters
- fileId string
- commentId string
- replyId string
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Taskpublic async Task<byte[]> DownloadAsync(string fileId, IProgress<GoogleDriveTransferProgress>? progress = null, TranslationReport? report = null, CancellationToken cancellationToken = default, long? maxResponseBytes = null) #Downloads binary file content into memory subject to the configured or per-call size limit.
Parameters
- fileId string
- progress System.IProgress<OfficeIMO.GoogleWorkspace.Drive.GoogleDriveTransferProgress>? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
- maxResponseBytes long? = null
Returns
Task<byte[]>public async Task<GoogleDriveDownloadCheckpoint> DownloadToFileAsync(string fileId, string destinationPath, GoogleDriveDownloadCheckpoint? checkpoint = null, Func<GoogleDriveDownloadCheckpoint, CancellationToken, Task>? checkpointSink = null, int chunkSize = 8388608, TranslationReport? report = null, CancellationToken cancellationToken = default) #Downloads to a new file or resumes an exact checkpoint after process restart.
Parameters
- fileId string
- destinationPath string
- checkpoint OfficeIMO.GoogleWorkspace.Drive.GoogleDriveDownloadCheckpoint? = null
- checkpointSink System.Func<OfficeIMO.GoogleWorkspace.Drive.GoogleDriveDownloadCheckpoint, System.Threading.CancellationToken, System.Threading.Tasks.Task>? = null
- chunkSize int = 8388608
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveDownloadCheckpoint>public async Task<byte[]> ExportAsync(string fileId, string mimeType, IProgress<GoogleDriveTransferProgress>? progress = null, TranslationReport? report = null, CancellationToken cancellationToken = default, long? maxResponseBytes = null) #Exports a Google-native file into memory using the requested MIME type and size limit.
Parameters
- fileId string
- mimeType string
- progress System.IProgress<OfficeIMO.GoogleWorkspace.Drive.GoogleDriveTransferProgress>? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
- maxResponseBytes long? = null
Returns
Task<byte[]>public async Task<GoogleDriveFile> GetFileAsync(string fileId, string? fields = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Gets metadata for one Drive file using the default or caller-selected field projection.
Parameters
- fileId string
- fields string? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveFile>public async Task<GoogleDriveAboutFormats> GetFormatsAsync(TranslationReport? report = null, CancellationToken cancellationToken = default) #Gets the MIME formats Drive can import and export for the current account.
Parameters
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveAboutFormats>public static IReadOnlyList<string> GetRequiredScopes(GoogleDriveOperation operation) #Returns the default scope used by this client for a logical Drive operation.
Parameters
- operation OfficeIMO.GoogleWorkspace.Drive.GoogleDriveOperation
Returns
IReadOnlyList<string>public async Task<string> GetStartPageTokenAsync(string? driveId = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Gets a starting token for a user or shared-drive change feed.
Parameters
- driveId string? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<string>public async Task<GoogleDriveChangeList> ListChangesAsync(string pageToken, GoogleDriveChangeListOptions? options = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Reads one page from a Drive change feed and returns continuation state.
Parameters
- pageToken string
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveChangeListOptions? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveChangeList>public async Task<GoogleDriveCommentList> ListCommentsAsync(string fileId, string? pageToken = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Lists one page of comments, including deleted threads and replies.
Parameters
- fileId string
- pageToken string? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveCommentList>public async Task<GoogleDriveFileList> ListFilesAsync(GoogleDriveListOptions? options = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Lists one page of Drive files using the requested query and corpus options.
Parameters
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveListOptions? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveFileList>public async Task<GoogleDrivePermissionList> ListPermissionsAsync(string fileId, string? pageToken = null, int? pageSize = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Lists one page of permissions for a file or shared drive.
Parameters
- fileId string
- The file or shared-drive identifier.
- pageToken string? = null
- The continuation token returned by the previous page.
- pageSize int? = null
- The requested number of permissions. Google Drive caps this value at 100.
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- An optional translation report that receives API diagnostics.
- cancellationToken System.Threading.CancellationToken = default
- A token that cancels the request.
Returns
Task<GoogleDrivePermissionList> The requested permission page and its continuation token, when another page exists.public async Task<GoogleDriveRevisionList> ListRevisionsAsync(string fileId, string? pageToken = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Lists one page of revision metadata for a Drive file.
Parameters
- fileId string
- pageToken string? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveRevisionList>public async Task<GoogleDriveFile> MoveFileAsync(string fileId, string folderId, TranslationReport? report = null, CancellationToken cancellationToken = default) #Moves a file to one folder, removing its existing parents when necessary.
Parameters
- fileId string
- folderId string
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveFile>public async Task<GoogleDriveFile> ResolveFolderAsync(string folderId, string? expectedDriveId = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Gets a folder and verifies its type and, when supplied, containing shared drive.
Parameters
- folderId string
- expectedDriveId string? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveFile>public async Task<GoogleDriveFile> UploadMultipartAsync(byte[] content, GoogleDriveUploadOptions options, TranslationReport? report = null, CancellationToken cancellationToken = default) #Uploads content of at most 5 MiB in one multipart request.
Parameters
- content byte[]
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveUploadOptions
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveFile> UploadResumableAsync(byte[] content, GoogleDriveUploadOptions options, TranslationReport? report = null, CancellationToken cancellationToken = default) #Uploads in aligned resumable chunks and reconciles ambiguous chunk responses with the server session.
Parameters
- content byte[]
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveUploadOptions
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveResumableUploadResult> UploadResumableFileAsync(string path, GoogleDriveUploadOptions options, GoogleDriveResumableUploadCheckpoint? checkpoint = null, Func<GoogleDriveResumableUploadCheckpoint, CancellationToken, Task>? checkpointSink = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Uploads a file through the durable resumable path.
Parameters
- path string
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveUploadOptions
- checkpoint OfficeIMO.GoogleWorkspace.Drive.GoogleDriveResumableUploadCheckpoint? = null
- checkpointSink System.Func<OfficeIMO.GoogleWorkspace.Drive.GoogleDriveResumableUploadCheckpoint, System.Threading.CancellationToken, System.Threading.Tasks.Task>? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveResumableUploadResult>public async Task<GoogleDriveResumableUploadResult> UploadResumableStreamAsync(Stream content, long length, GoogleDriveUploadOptions options, GoogleDriveResumableUploadCheckpoint? checkpoint = null, Func<GoogleDriveResumableUploadCheckpoint, CancellationToken, Task>? checkpointSink = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Uploads a seekable stream and persists progress after initiation and every confirmed chunk.
Parameters
- content System.IO.Stream
- length long
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveUploadOptions
- checkpoint OfficeIMO.GoogleWorkspace.Drive.GoogleDriveResumableUploadCheckpoint? = null
- checkpointSink System.Func<OfficeIMO.GoogleWorkspace.Drive.GoogleDriveResumableUploadCheckpoint, System.Threading.CancellationToken, System.Threading.Tasks.Task>? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<GoogleDriveResumableUploadResult>Inherited Methods
Fields
public const string DefaultFileFields #Default Drive fields requested for file metadata.
id,name,mimeType,driveId,parents,webViewLink,webContentLink,modifiedTime,createdTime,version,size,trashed,capabilities(canDownload,canEdit,canMoveItemWithinDrive,canMoveItemOutOfDrive,canDelete,canShare,canComment)