Class FilesResource
The "files" collection of methods.
Inheritance
Inherited Members
Namespace: Google.Apis.Drive.v3
Assembly: Google.Apis.Drive.v3.dll
Syntax
public class FilesResource
Constructors
FilesResource(IClientService)
Constructs a new resource.
Declaration
public FilesResource(IClientService service)
Parameters
Type | Name | Description |
---|---|---|
IClientService | service |
Methods
Copy(File, String)
Creates a copy of a file and applies any requested updates with patch semantics. Folders cannot be copied.
Declaration
public virtual FilesResource.CopyRequest Copy(File body, string fileId)
Parameters
Type | Name | Description |
---|---|---|
File | body | The body of the request. |
System.String | fileId | The ID of the file. |
Returns
Type | Description |
---|---|
FilesResource.CopyRequest |
Create(File)
Creates a new file.
Declaration
public virtual FilesResource.CreateRequest Create(File body)
Parameters
Type | Name | Description |
---|---|---|
File | body | The body of the request. |
Returns
Type | Description |
---|---|
FilesResource.CreateRequest |
Create(File, Stream, String)
Creates a new file.
Declaration
public virtual FilesResource.CreateMediaUpload Create(File body, Stream stream, string contentType)
Parameters
Type | Name | Description |
---|---|---|
File | body | The body of the request. |
System.IO.Stream | stream | The stream to upload. See remarks for further information. |
System.String | contentType | The content type of the stream to upload. |
Returns
Type | Description |
---|---|
FilesResource.CreateMediaUpload |
Remarks
Considerations regarding stream
:
-
If
stream
is seekable, then the stream position will be reset to0
before reading commences. Ifstream
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.
Declaration
public virtual FilesResource.DeleteRequest Delete(string fileId)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileId | The ID of the file. |
Returns
Type | Description |
---|---|
FilesResource.DeleteRequest |
EmptyTrash()
Permanently deletes all of the user's trashed files.
Declaration
public virtual FilesResource.EmptyTrashRequest EmptyTrash()
Returns
Type | Description |
---|---|
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.
Declaration
public virtual FilesResource.ExportRequest Export(string fileId, string mimeType)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileId | The ID of the file. |
System.String | mimeType | The MIME type of the format requested for this export. |
Returns
Type | Description |
---|---|
FilesResource.ExportRequest |
GenerateIds()
Generates a set of file IDs which can be provided in create or copy requests.
Declaration
public virtual FilesResource.GenerateIdsRequest GenerateIds()
Returns
Type | Description |
---|---|
FilesResource.GenerateIdsRequest |
Get(String)
Gets a file's metadata or content by ID.
Declaration
public virtual FilesResource.GetRequest Get(string fileId)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileId | The ID of the file. |
Returns
Type | Description |
---|---|
FilesResource.GetRequest |
List()
Lists or searches files.
Declaration
public virtual FilesResource.ListRequest List()
Returns
Type | Description |
---|---|
FilesResource.ListRequest |
Update(File, String)
Updates a file's metadata and/or content. This method supports patch semantics.
Declaration
public virtual FilesResource.UpdateRequest Update(File body, string fileId)
Parameters
Type | Name | Description |
---|---|---|
File | body | The body of the request. |
System.String | fileId | The ID of the file. |
Returns
Type | Description |
---|---|
FilesResource.UpdateRequest |
Update(File, String, Stream, String)
Updates a file's metadata and/or content. This method supports patch semantics.
Declaration
public virtual FilesResource.UpdateMediaUpload Update(File body, string fileId, Stream stream, string contentType)
Parameters
Type | Name | Description |
---|---|---|
File | body | The body of the request. |
System.String | fileId | The ID of the file. |
System.IO.Stream | stream | The stream to upload. See remarks for further information. |
System.String | contentType | The content type of the stream to upload. |
Returns
Type | Description |
---|---|
FilesResource.UpdateMediaUpload |
Remarks
Considerations regarding stream
:
-
If
stream
is seekable, then the stream position will be reset to0
before reading commences. Ifstream
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
Declaration
public virtual FilesResource.WatchRequest Watch(Channel body, string fileId)
Parameters
Type | Name | Description |
---|---|---|
Channel | body | The body of the request. |
System.String | fileId | The ID of the file. |
Returns
Type | Description |
---|---|
FilesResource.WatchRequest |