GAS Google Drive - google-apps-script

this is question related to google apps script and Google Drive.
Is there any way to construct a URL for a file that causes opening that file in desktop application?
I'm basically asking whether it is possible to access "Open With" application list programmatically and pick up one from listed applications.
Now, when I get the URL, it causes opening another screen where I need to pickup an application and only then it starts opening. I would like to skip that step and open the file directly in a given desktop application.
Thank you!
Petr

"Open Width" requires having Google Drive for Desktop installed, having installed a Chrome extension and using Chrome.
Considering the above, since Google Apps Script server side code hasn't access to user environment it's not possible to
"Open With" application list programmatically and pick up one from listed applications.

Related

Sharing Google Drive Realtime Documents

I have created a realtime document on Google Drive. When I attempt to share this file with someone who doesn't have my app installed, the file shares successfully, but when they click the file it says "Sorry, no preview is available".
This realtime document is a shortcut file. How do I get it to prompt the person to authorize my app?
I'm using the Realtime Playground as my example as I'm not sure of the specifics of your application.
App authorisation
When you created your application you visited the Google API Console and created a project with Drive API enabled. At some point you copied "Client ID" from the Google API Console into you application ID code.
In the realtime-playground case APP_ID is set in the javascript file rtpg.js (you might not be using JavaScript but there will be an equivalent step for other languages).
rtpg.APP_ID = '840867953062';
File creation
I believe that any drive realtime document/shortcut you created with your application will contain a reference to the creating application (mostly likely in the form of the client/application ID you obtained above).
File sharing
Once you can see your newly created Google Drive Realtime document/shortcut you can share this with somebody else using the normal Google Drive sharing methods. At this point they can see it but cannot do anything apparently useful with it. This is where I believe your application may differ from the realtime-playground example.
Integration with Chrome Web Store
On the GitHub repository for realtime-playground you'll notice a cws (Chrome Web Store) directory containing the stuff necessary to deploy the realtime-playground as Google Drive application in the Chrome Store including screenshots to be used. If you look at the manifest.json file you will see another reference to the client id:
"api_console_project_id" : "840867953062"
So if I share a realtime-playground file with somebody who doesn't have it installed, then clicking on the file in Google Drive will result in a "Connect app" popup which will try to locate the corresponding Chrome Web Store Drive app (using the common id as the key) and this will show something similar to what you might see if you found this application directly in the Chrome Web Store.
The manifest.json also contains:
"app" : { "launch" : {
"web_url" : "https://realtimeplayground.appspot.com/" } }
which tells Google Drive what to do when the installed app is called.
So my guess is that your application doesn't work like this as you don't yet have public visibility of your app in the Chrome Web Store.
See also: Create a Chrome Web Store Listing
I hope this helps.
That is fine. If you open your eyes, you will notice that Playground demo does not provide any preview either
Yet, you see, the associated app is available. You can click it and open-with works normally. Your app-created files operate similarly. They are associated with your app by default. You can open them by open with rather than by preview. Can you? No, you cannot. But that is another question.
Otherwise, I see no cleverness in associating your file with chrome extension rather than with your app.
How do I get it to prompt the person to authorize my app?
I recently had a similar question. Instead of linking your files with extension in chrome, pass the direct link, like http://your-app#fileId=..., as playground demonstrates to your shared fellow if open-with fails.
The preview seems to be another story.
Wait, Do you mean that I need to create a new fresh account to test how your file is unassociated with your app? How do you preview the files in your primary account? If you know how to preview you may answer my question, at least partially. But why do you associate authorization with preview?

Google drive sdk app not showing in open with list

I have a google drive app. It is setup to be a drive app and the open url is given in the app details.
Everything works well, but for some reason when the user installs the app it is not displayed in the "Open with" list of apps.
the app is setup to use google documents and docx (this is given in the default mime types).
I also had pdf in the mime types and it was working for them I switched it off and it was correctly turned off.
Any idea why an app might not be showing up in the "open with" menu by default?
Please get back to me as this is having a huge impact we are getting a lot of questions from users that are not being able to find the app..we have over 1000 installations already.
The app also has a launch icon setup on the manifest file. I don't supposed this affects it's behaviour on drive?
"launch": {
"web_url": "http://mail.google.com/mail/"
}
Best regards,
Joao Garin
Have you enabled both the Drive API and the Drive SDK in the Google Developer Console?
See the details on enable the drive platform and make sure you have everything configured properly.

If I use the Google Drive SDK in my app is it possible to hide the saved data from the user?

I want to use the Google drive sdk to save data from my app in the user's own Google drive account. This will mean that the developers of the app (i.e. me) won't have access to sensitive data that the user is storing.
I have found some docs about how to do this (the app will be a Google app engine app) but I was wondering if I can lock this data or hide it completely so that a user can't go in and edit the data and possibly cause problems.
I know that Android apps that use Google drive do not leave any visible files that I can see when I go to my drive account.
Thanks
When creating the file, set the hidden label to True. This will hide the file from most user views. Note that it doesn't completely prevent the user from finding and modifying the file if they own it.
If you need the file to be uneditable by the owner, your app will need to own it and only grant the user view access.
In Google Play Services 4.3, they added an "Application Folder." This is designed to allow applications to store data in a user's drive without allowing them to modify this data. It's available for android and web, don't see it listed for iOS.

Determine if a certain File is process by a project that uses Google Drive API

Good day! I am currently developing a website using Google Drive API. However, I am wondering if is it possible to know if a certain file is created/uploaded/shared by the project using an App Id. I was thinking if it is belong to the attributes of a file. But, when i checked, it seems that, there's no such thing.
What I am trying to do, is to filter the files' shared by the other user to the owner of the account using my web site. Is it possible? Any suggestions on how to do it?
Thank you in advance.
File metadata doesn't contain this information unfortunatelly, therefore you can't know if some file was created by your app or not. But FYI Google store it somewhere, if you will try to upload somefile without providing its content type (* / *) and after that try to open this file through browser you will see the message:
No preview available
This item was created with YourAppName, a Google Drive app.
Download this file or use one of the apps you have installed to open it.

Get listed in Google Drive Apps Collection

I have released an app for Google Drive in the Chrome Web Store. I thought it might get added to the Google Drive Collection automatically, but that didn't happen. Is there any form I have to submit?
For your application to appear in the collection of Drive apps your Chrome Web Store app's manifest file need to specify the Google Drive container and your API console project ID as described in this document.
Then your app's listing should get the "Works with Google Drive" badge and, given a few minutes delay for indexing, your app will appear on the collection of Drive apps.
Beware: you may not see it there as a listing doesn't appear for you in that collection if you have already installed it on your browser. It will appear to all other users who have not installed your app yet. To make sure it's there: try looking at the collection with another browser (FireFox for instance).