I'm trying to create an external link in Google Drive (mime type application/vnd.google-apps.drive-sdk) through the App Script of my Add-on. The end to end goal is to create this file, send the id to an external service (my service) and that way, when my users clicks the "Open with..." on this file in Google Drive, it will send them to my service along with the state param (which contains the fileId) and I can Do The Right Thing (TM) with it.
For some reason, I can't seem to get the DriveApp API in App Script to do this. The code for this is:
const file = DriveApp.createFile('DriveAppFile', '', 'application/vnd.google-apps.drive-sdk');
The createFile calls fails with Error Exception: Invalid argument. From what I gather, it's the mimeType parameter that the interpreter doesn't like. I am explicitly setting the contents to empty string because this is required for a file of type application/vnd.google-apps.drive-sdk as per Google's docs. I have also tried null for the contents but to no avail. Does anyone know why this isn't working?
One other piece of information: out of curiosity, I tried to perform this same action from a test nodeJS app using the googleapis:v3 and surprisingly, everything works fine. While it does work, this is not a good option for my users because I don't want to have them OAuth connect from my external app to Google just to perform this one action when they have already OAuth'ed via my Add-on.
Aucun commentaire:
Enregistrer un commentaire