Class FilesResource
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
Returns
Create(File)
Creates a new file.
public virtual FilesResource.CreateRequest Create(File body)
Parameters
body
FileThe body of the request.
Returns
Create(File, Stream, string)
Creates a new file.
public virtual FilesResource.CreateMediaUpload Create(File body, Stream stream, string contentType)
Parameters
body
FileThe body of the request.
stream
StreamThe stream to upload. See remarks for further information.
contentType
stringThe content type of the stream to upload.
Returns
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.
public virtual FilesResource.DeleteRequest Delete(string fileId)
Parameters
fileId
stringThe ID of the file.
Returns
EmptyTrash()
Permanently deletes all of the user's trashed files.
public virtual FilesResource.EmptyTrashRequest EmptyTrash()
Returns
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
stringThe ID of the file.
mimeType
stringThe MIME type of the format requested for this export.
Returns
GenerateIds()
Generates a set of file IDs which can be provided in create or copy requests.
public virtual FilesResource.GenerateIdsRequest GenerateIds()
Returns
Get(string)
Gets a file's metadata or content by ID.
public virtual FilesResource.GetRequest Get(string fileId)
Parameters
fileId
stringThe ID of the file.
Returns
List()
Lists or searches files.
public virtual FilesResource.ListRequest List()
Returns
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
Returns
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
FileThe body of the request.
fileId
stringThe ID of the file.
stream
StreamThe stream to upload. See remarks for further information.
contentType
stringThe content type of the stream to upload.
Returns
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
public virtual FilesResource.WatchRequest Watch(Channel body, string fileId)