So I've used a little Google Apps script to make a public folder (type: anyone, role: reader) and then I've requested and received the WebViewLink. But when I go to that link, it says there are no files. I've placed (via Google Drive web interface, not via the app script) an index.html file (document) in that folder.
Do I have to MAKE all the files in the folder via the app script?
I seem to have heard on one of the announcements about this that once the folder is created, you can just drop files into it.
Found the answer myself. The documents in the folder must be of the correct type or they just don't show up. E.g. a google docs document called index.html is NOT an html document. You have to create a standard html page locally and then upload it, but never open or edit it with google docs (drive, whatever) in order for it to be seen. I put detailed instructions on a web page hosted by Google Drive here:
https://googledrive.com/host/0B0ap0WDOII5mbjdwajNBMlRoZUU/
Related
TLDR: Google Drive does not index markdown files or mime type text/markdown by default. I'm looking for a way to make sure that all files in a specified directory are being indexed by Google Drive.
I have applications on Windows desktop and Android mobile such as Obsidian and Markor that saves markdown document files (.md) to a Google Drive folder with a mime type of text/markdown.
When I attempt to search for terms in the content of the markdown files from the Google Drive website, they do not appear to have been indexed and cannot be found. I can only find terms in the filename of the markdown files.
I can create a text document (.txt) with the same content as the markdown file and they are saved to Google Drive with a mime type of text/plain. The content of these text files are indexed and can be found using search on the Google Drive website.
I came across the following article indicating that there is a way via the Google Drive API/SDK to mark a special Google Drive attribute called indexableText to 'true' for mime types that are not indexed by default by Google Drive.
https://gsuite-developers.googleblog.com/2013/02/how-to-make-files-searchable-in-google.html
It states, "We recently added a way for you to indicate that the file you are uploading is using a readable text format,".
The excerpt indicates that this method is meant to be used as the files are being uploaded.
My question is whether it's possible to set the indexableText attribute to 'true' on existing files or after the files have already been uploaded?
My goal is to have a script that is either triggered by the creation of a new file or that runs at regularly scheduled intervals to make sure that all files in a specified directory are being indexed by Google Drive.
If there are already apps, scripts or services that provide this functionality, I would welcome your recommendations.
I noticed this behavior on Google Drive.
When a link is created for a file on Google Drive, the link is valid until the file is deleted.
Moving the file to another folder(s) does not affect the behavior of url.
I will like to understand how they achieved this at scale.
This is an expected behavior when moving files to another folder within your google drive. This is because a google file URL is usually composed of the following:
product domain
product
document Id
Therefore, moving the file to another folder within the google drive will not affect the file URL because file path is not included in the URL format.
References:
Google Sheets API Overview
Docs API
If I open the shareable link I have got for a file from Google Drive in the browser, I always get either to the Drive's internal preview program or to a download page (See below).
I would like to know whether there is a programmatic way to launch a specific drive-connected application (with confirmed access permissions) to open a file for which I have the link (and thus, the ID as well).
I don't want to do this through the drive's interface, but rather within my program. Let's say I want to let the users browse their files and open them in the browser with their default app as they have defined it on their drive (and let's say I already know that app).
To make it clear, I just want to achieve what Google Drive's interface does in the browser: You click a file, and it opens in a new tab in your default app.
In my opinion, this is possible with the use of Advanced Drive Service and Drive Service.
Advanced Drive Service
The advanced Drive service allows you to use the Google Drive web API in Apps Script. Much like Apps Script's built-in Drive service, this API allows scripts to create, find, and modify files and folders in Google Drive. In most cases, the built-in service is easier to use, but this advanced service provides a few extra features, including access to custom file properties as well as revisions for files and folders.
and for the Drive Service, you can use getUrl() method to get the URL that can be used to open the File in a Google App like Drive or Docs.
This service allows scripts to create, find, and modify files and folders in Google Drive.
Detailed information and sample codes regarding these services can be found in the documentations.
I have a Google Site based on this template https://sites.google.com/site/theintranetsitetemplate/. It exists in the company's Google Apps domain account. I would like to know if there is a way to sync the documents page with Google Docs and the directory page with Google Contacts directory. If so, does this require Google Apps Script?
You can insert a Google Drive folder gadget that points to the shared folder.
In editing mode on a page, click Insert > Drive > Folder.
Browse to the folder to share (or paste the folder's URL in the box). Be sure that the folder is shared with the public, or this will not work.
Sharing out a domain's full directory is not easy (even suggesting it would make many IT depts queasy), but defintely can be done with an Apps Script (see the dev page).
If there's a folder on someone's Drive with sharing set so anyone with the link can view it, can a Google Apps Script see its contents? That is:
DocsList.getFolderByID(id).getFiles()
will show me the contents of a folder on my (or the user's) Drive. But is there a similar method for viewing files in a publicly shared folder? Thanks.
If by "public folder" you mean "a folder in another user's Google Drive that has been shared as public", then the answer is yes.
Nothing special - just use the ID of the folder as you would your own. There are some methods that you will not be able to use, for example Document.getOwner() will complain about permissions.