Notice: important security update for Drive document URLs and resource keys. For more information, refer to Access link-shared files using resource keys

Create a shortcut to an external file

Third-party shortcuts are files that link to files on other, external, storage systems.

To create a third-party shortcut, use the files.create method of the API and make sure you set the MIME type application/ Do not upload any content when creating the file.


File fileMetadata = new File();
fileMetadata.setTitle("Project plan");

File file = driveService.files().insert(fileMetadata)
System.out.println("File ID: " + file.getId());


file_metadata = {
    'title': 'Project plan',
    'mimeType': 'application/'
file = drive_service.files().insert(body=file_metadata,
print 'File ID: %s' % file.get('id')


$fileMetadata = new Google_Service_Drive_DriveFile(array(
    'title' => 'Project plan',
    'mimeType' => 'application/'));
$file = $driveService->files->insert($fileMetadata, array(
    'fields' => 'id'));
printf("File ID: %s\n", $file->id);


var fileMetadata = new File()
    Title = "Project plan",
    MimeType = "application/"
var request = driveService.Files.Insert(fileMetadata);
request.Fields = "id";
var file = request.Execute();
Console.WriteLine("File ID: " + file.Id);


file_metadata = {
    title: 'Project plan',
    mime_type: 'application/'
file = drive_service.insert_file(file_metadata, fields: 'id')
puts "File Id: #{}"


var fileMetadata = {
  'title': 'Project plan',
  'mimeType': 'application/'
  resource: fileMetadata,
  fields: 'id'
}, function (err, file) {
  if (err) {
    // Handle error
  } else {
    console.log('File Id:',;

Adding custom thumbnails and indexable text

To increase the discoverability of files associated with third-party shortcuts, you can upload both thumbnail images and indexable text when inserting or modifying the file metadata. For more information, see Manage File Metadata.