API Reference
GoogleDriveClient
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) #Task<GoogleDriveFile>Copies a Drive file with an optional new name and parent.
Parameters
- fileId System.String
- name System.String? = null
- parentId System.String? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveComment> CreateCommentAsync(String fileId, String content, String? anchor = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveComment>Creates a Drive comment and reports the editor limitation for custom anchors.
Parameters
- fileId System.String
- content System.String
- anchor System.String? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveFile> CreateFolderAsync(String name, String? parentId = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveFile>Creates a Drive folder, optionally under a parent folder.
Parameters
- name System.String
- parentId System.String? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDrivePermission> CreatePermissionAsync(String fileId, GoogleDrivePermissionCreateOptions options, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDrivePermission>Creates a permission for a file or shared drive.
Parameters
- fileId System.String
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDrivePermissionCreateOptions
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveReply> CreateReplyAsync(String fileId, String commentId, String content, String? action = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveReply>Creates a reply or applies an action such as resolving a comment thread.
Parameters
- fileId System.String
- commentId System.String
- content System.String
- action System.String? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task DeleteCommentAsync(String fileId, String commentId, TranslationReport? report = null, CancellationToken cancellationToken = default) #TaskDeletes a Drive comment thread from a file.
Parameters
- fileId System.String
- commentId System.String
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task DeleteFileAsync(String fileId, TranslationReport? report = null, CancellationToken cancellationToken = default) #TaskPermanently deletes a Drive file using guarded mutation policy.
Parameters
- fileId System.String
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task DeletePermissionAsync(String fileId, String permissionId, TranslationReport? report = null, CancellationToken cancellationToken = default) #TaskDeletes a permission from a file or shared drive.
Parameters
- fileId System.String
- permissionId System.String
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task DeleteReplyAsync(String fileId, String commentId, String replyId, TranslationReport? report = null, CancellationToken cancellationToken = default) #TaskDeletes a reply from a Drive comment thread.
Parameters
- fileId System.String
- commentId System.String
- replyId System.String
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<Byte[]> DownloadAsync(String fileId, IProgress<GoogleDriveTransferProgress>? progress = null, TranslationReport? report = null, CancellationToken cancellationToken = default, Int64? maxResponseBytes = null) #Task<Byte[]>Downloads binary file content into memory subject to the configured or per-call size limit.
Parameters
- fileId System.String
- progress System.IProgress<OfficeIMO.GoogleWorkspace.Drive.GoogleDriveTransferProgress>? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
- maxResponseBytes System.Int64? = null
public async Task<GoogleDriveDownloadCheckpoint> DownloadToFileAsync(String fileId, String destinationPath, GoogleDriveDownloadCheckpoint? checkpoint = null, Func<GoogleDriveDownloadCheckpoint, CancellationToken, Task>? checkpointSink = null, Int32 chunkSize = 8388608, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveDownloadCheckpoint>Downloads to a new file or resumes an exact checkpoint after process restart.
Parameters
- fileId System.String
- destinationPath System.String
- checkpoint OfficeIMO.GoogleWorkspace.Drive.GoogleDriveDownloadCheckpoint? = null
- checkpointSink System.Func<OfficeIMO.GoogleWorkspace.Drive.GoogleDriveDownloadCheckpoint, System.Threading.CancellationToken, System.Threading.Tasks.Task>? = null
- chunkSize System.Int32 = 8388608
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<Byte[]> ExportAsync(String fileId, String mimeType, IProgress<GoogleDriveTransferProgress>? progress = null, TranslationReport? report = null, CancellationToken cancellationToken = default, Int64? maxResponseBytes = null) #Task<Byte[]>Exports a Google-native file into memory using the requested MIME type and size limit.
Parameters
- fileId System.String
- mimeType System.String
- progress System.IProgress<OfficeIMO.GoogleWorkspace.Drive.GoogleDriveTransferProgress>? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
- maxResponseBytes System.Int64? = null
public async Task<GoogleDriveFile> GetFileAsync(String fileId, String? fields = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveFile>Gets metadata for one Drive file using the default or caller-selected field projection.
Parameters
- fileId System.String
- fields System.String? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveAboutFormats> GetFormatsAsync(TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveAboutFormats>Gets the MIME formats Drive can import and export for the current account.
Parameters
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public static IReadOnlyList<String> GetRequiredScopes(GoogleDriveOperation operation) #IReadOnlyList<String>Returns the default scope used by this client for a logical Drive operation.
Parameters
- operation OfficeIMO.GoogleWorkspace.Drive.GoogleDriveOperation
public async Task<String> GetStartPageTokenAsync(String? driveId = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<String>Gets a starting token for a user or shared-drive change feed.
Parameters
- driveId System.String? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveChangeList> ListChangesAsync(String pageToken, GoogleDriveChangeListOptions? options = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveChangeList>Reads one page from a Drive change feed and returns continuation state.
Parameters
- pageToken System.String
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveChangeListOptions? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveCommentList> ListCommentsAsync(String fileId, String? pageToken = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveCommentList>Lists one page of comments, including deleted threads and replies.
Parameters
- fileId System.String
- pageToken System.String? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveFileList> ListFilesAsync(GoogleDriveListOptions? options = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveFileList>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
public async Task<GoogleDrivePermissionList> ListPermissionsAsync(String fileId, String? pageToken = null, Int32? pageSize = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDrivePermissionList>Lists one page of permissions for a file or shared drive.
Parameters
- fileId System.String
- The file or shared-drive identifier.
- pageToken System.String? = null
- The continuation token returned by the previous page.
- pageSize System.Int32? = 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
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) #Task<GoogleDriveRevisionList>Lists one page of revision metadata for a Drive file.
Parameters
- fileId System.String
- pageToken System.String? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveFile> MoveFileAsync(String fileId, String folderId, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveFile>Moves a file to one folder, removing its existing parents when necessary.
Parameters
- fileId System.String
- folderId System.String
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveFile> ResolveFolderAsync(String folderId, String? expectedDriveId = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveFile>Gets a folder and verifies its type and, when supplied, containing shared drive.
Parameters
- folderId System.String
- expectedDriveId System.String? = null
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
public async Task<GoogleDriveFile> UploadMultipartAsync(Byte[] content, GoogleDriveUploadOptions options, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveFile>Uploads content of at most 5 MiB in one multipart request.
Parameters
- content System.Byte[]
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveUploadOptions
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Metadata for the created Drive file.
public async Task<GoogleDriveFile> UploadResumableAsync(Byte[] content, GoogleDriveUploadOptions options, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveFile>Uploads in aligned resumable chunks and reconciles ambiguous chunk responses with the server session.
Parameters
- content System.Byte[]
- options OfficeIMO.GoogleWorkspace.Drive.GoogleDriveUploadOptions
- report OfficeIMO.GoogleWorkspace.TranslationReport? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Metadata for the created Drive file.
public async Task<GoogleDriveResumableUploadResult> UploadResumableFileAsync(String path, GoogleDriveUploadOptions options, GoogleDriveResumableUploadCheckpoint? checkpoint = null, Func<GoogleDriveResumableUploadCheckpoint, CancellationToken, Task>? checkpointSink = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveResumableUploadResult>Uploads a file through the durable resumable path.
Parameters
- path System.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
public async Task<GoogleDriveResumableUploadResult> UploadResumableStreamAsync(Stream content, Int64 length, GoogleDriveUploadOptions options, GoogleDriveResumableUploadCheckpoint? checkpoint = null, Func<GoogleDriveResumableUploadCheckpoint, CancellationToken, Task>? checkpointSink = null, TranslationReport? report = null, CancellationToken cancellationToken = default) #Task<GoogleDriveResumableUploadResult>Uploads a seekable stream and persists progress after initiation and every confirmed chunk.
Parameters
- content System.IO.Stream
- length System.Int64
- 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
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
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)