| Modifier and Type | Class and Description | 
|---|---|
class  | 
Drive.Files.Copy  | 
class  | 
Drive.Files.Create  | 
class  | 
Drive.Files.Delete  | 
class  | 
Drive.Files.Download  | 
class  | 
Drive.Files.EmptyTrash  | 
class  | 
Drive.Files.Export  | 
class  | 
Drive.Files.GenerateIds  | 
class  | 
Drive.Files.Get  | 
class  | 
Drive.Files.List  | 
class  | 
Drive.Files.ListLabels  | 
class  | 
Drive.Files.ModifyLabels  | 
class  | 
Drive.Files.Update  | 
class  | 
Drive.Files.Watch  | 
| Constructor and Description | 
|---|
Files()  | 
| Modifier and Type | Method and Description | 
|---|---|
Drive.Files.Copy | 
copy(String fileId,
    File content)
Creates a copy of a file and applies any requested updates with patch semantics. 
 | 
Drive.Files.Create | 
create(File content)
Creates a file. 
 | 
Drive.Files.Create | 
create(File content,
      com.google.api.client.http.AbstractInputStreamContent mediaContent)
Creates a file. 
 | 
Drive.Files.Delete | 
delete(String fileId)
Permanently deletes a file owned by the user without moving it to the trash. 
 | 
Drive.Files.Download | 
download(String fileId)
Downloads the content of a file. 
 | 
Drive.Files.EmptyTrash | 
emptyTrash()
Permanently deletes all of the user's trashed files. 
 | 
Drive.Files.Export | 
export(String fileId,
      String mimeType)
Exports a Google Workspace document to the requested MIME type and returns exported byte content. 
 | 
Drive.Files.GenerateIds | 
generateIds()
Generates a set of file IDs which can be provided in create or copy requests. 
 | 
Drive.Files.Get | 
get(String fileId)
Gets a file's metadata or content by ID. 
 | 
Drive.Files.List | 
list()
Lists the user's files. 
 | 
Drive.Files.ListLabels | 
listLabels(String fileId)
Lists the labels on a file. 
 | 
Drive.Files.ModifyLabels | 
modifyLabels(String fileId,
            ModifyLabelsRequest content)
Modifies the set of labels applied to a file. 
 | 
Drive.Files.Update | 
update(String fileId,
      File content)
Updates a file's metadata, content, or both. 
 | 
Drive.Files.Update | 
update(String fileId,
      File content,
      com.google.api.client.http.AbstractInputStreamContent mediaContent)
Updates a file's metadata, content, or both. 
 | 
Drive.Files.Watch | 
watch(String fileId,
     Channel content)
Subscribes to changes to a file. 
 | 
public Drive.Files.Copy copy(String fileId, File content) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.fileId - The ID of the file.content - the FileIOExceptionpublic Drive.Files.Create create(File content) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.content - the FileIOExceptionpublic Drive.Files.Create create(File content, com.google.api.client.http.AbstractInputStreamContent mediaContent) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.
 This method should be used for uploading media content.
content - the File media metadata or null if nonemediaContent - The media HTTP content.IOException - if the initialization of the request failspublic Drive.Files.Delete delete(String fileId) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.fileId - The ID of the file.IOExceptionpublic Drive.Files.Download download(String fileId) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.fileId - Required. The ID of the file to download.IOExceptionpublic Drive.Files.EmptyTrash emptyTrash() throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.IOExceptionpublic Drive.Files.Export export(String fileId, String mimeType) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.fileId - The ID of the file.mimeType - Required. The MIME type of the format requested for this export. For a list of supported MIME types,
        see [Export MIME types for Google Workspace documents](/workspace/drive/api/guides/ref-
        export-formats).IOExceptionpublic Drive.Files.GenerateIds generateIds() throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.IOExceptionpublic Drive.Files.Get get(String fileId) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.fileId - The ID of the file.IOExceptionpublic Drive.Files.List list() throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.IOExceptionpublic Drive.Files.ListLabels listLabels(String fileId) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.fileId - The ID for the file.IOExceptionpublic Drive.Files.ModifyLabels modifyLabels(String fileId, ModifyLabelsRequest content) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.fileId - The ID of the file to which the labels belong.content - the ModifyLabelsRequestIOExceptionpublic Drive.Files.Update update(String fileId, File content) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.fileId - The ID of the file.content - the FileIOExceptionpublic Drive.Files.Update update(String fileId, File content, com.google.api.client.http.AbstractInputStreamContent mediaContent) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.
 This method should be used for uploading media content.
fileId - The ID of the file.content - the File media metadata or null if nonemediaContent - The media HTTP content.IOException - if the initialization of the request failspublic Drive.Files.Watch watch(String fileId, Channel content) throws IOException
AbstractGoogleClientRequest.execute() method to invoke the remote operation.fileId - The ID of the file.content - the ChannelIOExceptionCopyright © 2011–2025 Google. All rights reserved.