Table of Contents

Class FilesResource

Namespace
Google.Apis.Drive.v3
Assembly
Google.Apis.Drive.v3.dll

The "files" collection of methods.

public class FilesResource
Inheritance
FilesResource
Inherited Members

Constructors

FilesResource(IClientService)

Constructs a new resource.

public FilesResource(IClientService service)

Parameters

service IClientService

Methods

Copy(File, string)

Creates a copy of a file and applies any requested updates with patch semantics. Folders cannot be copied.

public virtual FilesResource.CopyRequest Copy(File body, string fileId)

Parameters

body File

The body of the request.

fileId string

The ID of the file.

Returns

FilesResource.CopyRequest

Create(File)

Creates a new file.

public virtual FilesResource.CreateRequest Create(File body)

Parameters

body File

The body of the request.

Returns

FilesResource.CreateRequest

Create(File, Stream, string)

Creates a new file.

public virtual FilesResource.CreateMediaUpload Create(File body, Stream stream, string contentType)

Parameters

body File

The body of the request.

stream Stream

The stream to upload. See remarks for further information.

contentType string

The content type of the stream to upload.

Returns

FilesResource.CreateMediaUpload

Remarks

Considerations regarding stream:

  • If stream is seekable, then the stream position will be reset to 0 before reading commences. If stream is not seekable, then it will be read from its current position.
  • Caller is responsible for maintaining the stream open until the upload is completed.
  • Caller is responsible for closing the stream.

Delete(string)

Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive the user must be an organizer on the parent. If the target is a folder, all descendants owned by the user are also deleted.

public virtual FilesResource.DeleteRequest Delete(string fileId)

Parameters

fileId string

The ID of the file.

Returns

FilesResource.DeleteRequest

EmptyTrash()

Permanently deletes all of the user's trashed files.

public virtual FilesResource.EmptyTrashRequest EmptyTrash()

Returns

FilesResource.EmptyTrashRequest

Export(string, string)

Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.

public virtual FilesResource.ExportRequest Export(string fileId, string mimeType)

Parameters

fileId string

The ID of the file.

mimeType string

The MIME type of the format requested for this export.

Returns

FilesResource.ExportRequest

GenerateIds()

Generates a set of file IDs which can be provided in create or copy requests.

public virtual FilesResource.GenerateIdsRequest GenerateIds()

Returns

FilesResource.GenerateIdsRequest

Get(string)

Gets a file's metadata or content by ID.

public virtual FilesResource.GetRequest Get(string fileId)

Parameters

fileId string

The ID of the file.

Returns

FilesResource.GetRequest

List()

Lists or searches files.

public virtual FilesResource.ListRequest List()

Returns

FilesResource.ListRequest

Update(File, string)

Updates a file's metadata and/or content. This method supports patch semantics.

public virtual FilesResource.UpdateRequest Update(File body, string fileId)

Parameters

body File

The body of the request.

fileId string

The ID of the file.

Returns

FilesResource.UpdateRequest

Update(File, string, Stream, string)

Updates a file's metadata and/or content. This method supports patch semantics.

public virtual FilesResource.UpdateMediaUpload Update(File body, string fileId, Stream stream, string contentType)

Parameters

body File

The body of the request.

fileId string

The ID of the file.

stream Stream

The stream to upload. See remarks for further information.

contentType string

The content type of the stream to upload.

Returns

FilesResource.UpdateMediaUpload

Remarks

Considerations regarding stream:

  • If stream is seekable, then the stream position will be reset to 0 before reading commences. If stream is not seekable, then it will be read from its current position.
  • Caller is responsible for maintaining the stream open until the upload is completed.
  • Caller is responsible for closing the stream.

Watch(Channel, string)

Subscribes to changes to a file

public virtual FilesResource.WatchRequest Watch(Channel body, string fileId)

Parameters

body Channel

The body of the request.

fileId string

The ID of the file.

Returns

FilesResource.WatchRequest