google-drive-api

How to use the “KeepRevisionForever” property to keep all file versions

强颜欢笑 提交于 2021-01-28 04:41:18
问题 I've recently loaded documents into Drive in C#, but was not aware of the KeepRevisionForever property. Now that I'm trying to upload newer versions of the documents, I'm trying to set this property to true , but it looks like it will only keep this property for the latest update. I.e., I'll upload up to version 5, but the KeepRevisionForever property is only set for version 4, not versions 1 - 3. Can the API allow for keeping revisions for all updates? Below is the code block where this is

Delete old files from a Google Drive folder

我的未来我决定 提交于 2021-01-28 04:33:37
问题 I created this script to delete files published more than 3 hours ago. And even if the latest file is older than 3 hours, it will not be deleted, so the folder will never be empty. I enabled google's advanced service called DRIVE API V2. I activated a trigger to analyze the folder every 5 minutes, but often the files are not deleted, they remain in the folder. The script works sometimes yes and sometimes no. I would like to know what is wrong or what I need to edit to make it work perfectly.

Delete old files from a Google Drive folder

本小妞迷上赌 提交于 2021-01-28 04:31:04
问题 I created this script to delete files published more than 3 hours ago. And even if the latest file is older than 3 hours, it will not be deleted, so the folder will never be empty. I enabled google's advanced service called DRIVE API V2. I activated a trigger to analyze the folder every 5 minutes, but often the files are not deleted, they remain in the folder. The script works sometimes yes and sometimes no. I would like to know what is wrong or what I need to edit to make it work perfectly.

create new folder in google drive with rest api

喜你入骨 提交于 2021-01-28 02:52:36
问题 How can I create a new folder in google drive using python only if it doesn't exists? I am completely new to this google APIs and python. (I have an access token for my account and I want to create folder using that.) create folder import json import requests headers = {"Authorization": "Bearer Token"} data = { "name": "name", "mimeType": "application/vnd.google-apps.folder" } r = requests.post("https://www.googleapis.com/drive/v3/files", headers=headers,data = data) print(r.text) Only file

Why is Google Drive returning 'Failed to parse Content-Range header.'?

不问归期 提交于 2021-01-28 02:11:11
问题 Here's my simple-dimple code for resuming a (possibly) interrupted upload to Google Drive: Using message = New ByteArrayContent(New Byte() {}) message.Headers.ContentRange = New Headers.ContentRangeHeaderValue(Session.Size) 'message.Headers.TryAddWithoutValidation("Content-Range", "bytes */*") Dim response = Await PutAsync("https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable&upload_id=" & Session.Code, message) Dim msg = Await response.Content.ReadAsStringAsync 'ERR: this is

Create a google spreadsheet in same folder as current file

爷,独闯天下 提交于 2021-01-27 21:37:33
问题 I have a google form script that I want to create a spreadsheet in the same folder as the form. var thisFileId = form.getId(); var parentFolder = DriveApp.getFolderById(thisFileId) spreadsheet = SpreadsheetApp.create(spreadsheetName); var spreadsheetID = spreadsheet.getId(); var spreasheetFile = DriveApp.getFileById(spreadsheetID); spreasheetFile.moveTo(parentFolder); I get an error on the last line : "Exception: Invalid argument: parent.mimeType" 回答1: I believe your goal as follows. You want

Google Drive API - How to work with the domain-wide service account and get all document list from domain

旧城冷巷雨未停 提交于 2021-01-27 21:18:51
问题 I was trying to use the service account of my App to access to all documents of all users in my domain. I was following these instructions: https://developers.google.com/drive/delegation But it didn't work. Could you please help me out on this?? Here is the problematic line of code GoogleCredential credential = new GoogleCredential.Builder() .setTransport(TRANSPORT) .setJsonFactory(jsonFactory) .setServiceAccountId("SERVICE_ACCOUNT_EMAIL") .setServiceAccountPrivateKeyFromP12File( new java.io

I wrote a script to copy files to a backup folder but standalone webapp file gets copied to root instead

喜欢而已 提交于 2021-01-27 20:38:28
问题 Does anyone know why this happens? It would be much more convenient to have all the files copied to the destination. I have a list of filenames and file ids 3 are spreadsheets and one is a standalone script which I deploy as a webapp. The three spreadsheet go to the correct place. The standalone webapp goes to the root. I don't think it's a duplicate as suggested. function backUpProjectFiles(){ var backupFolder=DriveApp.getFolderById(getGlobal('BackupDirId')); var subFldrName='BackUpFiles_' +

express-fileupload to Google Drive API

混江龙づ霸主 提交于 2021-01-27 19:43:00
问题 I can successfully save my uploaded image in my public uploads folder and integrate google drive api but it seems that it is uploading an empty file. What should I put in the body parameter of the Google Drive API from my req.files data {name: 'country.jpg',data: <Buffer ff d8 ff e0 00 10 4a 46 49 46 00 01 01 01 00 48 00 48 00 00 ff ed 26 0c 50 68 6f 74 6f 73 68 6f 70 20 33 2e 30 00 38 42 49 4d 04 04 00 00 00 00 00 22 ... 246290 more bytes>,size: 246340,encoding: '7bit',tempFilePath: ''

Get Google Drive files links using Drive File Stream

我与影子孤独终老i 提交于 2021-01-27 17:39:40
问题 I am using Drive File Stream to access to my Google Drive files. So I have the list of all my Google Drive files in Python (using os.path.walk ) but I want to know if it's possible to get the file online link. I am on Mac OS X and using Finder, with the secondary click, I have an option "Open with Google Drive" which directly open the file on my browser. I want to automatically do the same thing with all my files. 回答1: I recently discovered a much more efficient way of retrieving the Drive