DriveAPI

Which of Drive API v2 or v3 is used for DriveApp.searchFiles()

Gists

Experiment

It has investigated the differences between the documents of “Search for Files” for v2 and v3. The following table shows the comparison of v2 and v3 for “Valid fields for files.list”. The column of DriveApp.searchFiles() means whether the query can be used for DriveApp.searchFiles().

v2 v3 Difference DriveApp.searchFiles()
title name different v2: succeed, v3: fail
fullText fullText same
mimeType mimeType same
modifiedDate modifiedTime same
lastViewedByMeDate viewedByMeTime different v2: succeed, v3: fail
trashed trashed same
starred starred same
parents parents same
owners owners same
writers writers same
readers readers same
sharedWithMe sharedWithMe same
properties properties same
properties with visibility=‘PRIVATE’ appProperties different v2: succeed, v3: fail
visibility visibility same

Result

As the result, it is considered that DriveApp.searchFiles() is used as Drive API v2 yet.

Retrieving Files with Filename Included Special Characters using Google Apps Script

Gists

This sample script is for retrieving files with filename included special characters using Google Apps Script. The files are used on Google Drive.

The files with filename of special characters cannot be retrieved using DriveApp.getFilesByName(). This workaround solved this.

As a query parameter, name contains 'filename with special characters' is used. This contains is very important. name='filename with special characters' cannot retrieve such files. Today, it was found that name contains 'filename with special characters' is the workaround. I have been looking for this workaround for a while. Finally, I found this today. By using this method, filename included umlauts can be also retrieved.