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 to
application/vnd.google-apps.drive-sdk
. Don't upload any content when
creating the file.
Java
Python
PHP
.NET
Ruby
file_metadata = {
name: 'Project plan',
mime_type: 'application/vnd.google-apps.drive-sdk'
}
file = drive_service.create_file(file_metadata, fields: 'id')
puts "File Id: #{file.id}"
Node.js
Objective-C
GTLRDrive_File *metadata = [GTLRDrive_File object];
metadata.name = @"Project plan";
metadata.mimeType = @"application/vnd.google-apps.drive-sdk";
GTLRDriveQuery_FilesCreate *query = [GTLRDriveQuery_FilesCreate queryWithObject:metadata
uploadParameters:nil];
query.fields = @"id";
[driveService executeQuery:query completionHandler:^(GTLRServiceTicket *ticket,
GTLRDrive_File *file,
NSError *error) {
if (error == nil) {
NSLog(@"File ID %@", file.identifier);
} else {
NSLog(@"An error occurred: %@", error);
}
}];
Add custom thumbnails & 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.