Why can't i transfer ownership of google drive folder and files to other? (OwnershipTransfer libary is being used) - google-apps-script

The library I am using is from here.
The response has very little info to debug or I don't understand what is this. It supposed to be easy from what I read in the description.
Any help?

That's an intended behavior. From your screenshot, I'm assuming you're using a G Suite/Workspace account for your 5times.co.in email. Please take note that transferring files from one Workspace account to another workspace account or Gmail is not possible as of the moment.
This is a documented here: https://support.google.com/a/users/answer/9308960
You can transfer ownership of your Google Drive files and folders to someone else in your organization.
an alternative is to either use Shared Drive or download the file and re-upload it to your Gmail account.

A better way to do this is:
step-1: Transfer files from the drive (your Gdrive) to google cloud storage
step-2: Transfer files from google cloud storage to drive (new Gdrive, different organization)
Reference python code for file transfer between DRIVE & Google drive.
https://colab.research.google.com/drive/1Xc8E8mKC4MBvQ6Sw6akd_X5Z1cmHSNca

Related

Best way to backup (automatically, cron) google drive docs

I have a google drive for my company, and I would like to backup all theses data (mainly documents...) every days (in case of sb would delete them accidentally)... Is there an easy solution to do that ? I mean to copy all theses data, automatically to another google drive account or to my local disc ?
Thanks you,
Checkout Multcloud. This website allow to manage all your cloud spaces together. You can add your company's drive a/c and other drive a/c or dropbox or anything, then sync company a/c with the a/c that you want.
This is what Google Drive has to offer.
Install Google Drive on your Mac or PC
Automatically sync Google Drive files on your computer with your
Google Drive files on the web using "Google Drive for your Mac/PC."
You can do things like:
Drag files in and out of folders
Edit, save, and remove files
Any changes you make locally in your Google Drive folder will sync to
your "My Drive" on the web. That means if you share, move, edit, or
move files to trash, your changes will also show in My Drive the next
time your computer syncs.

is it possible to download GMail attachment to local folder?

i want to download attachment from gmail and save it to local folder using google script. i did some research about this and i could't find any solution.
so far, i managed to save gmail's attachment to google drive only.
var attachmentBlob = attachment[0].copyBlob();
var file = DriveApp.createFile(attachmentBlob);
folder.addFile(file);
or, is it possible to create a google script to auto download file from google drive?
need some advice.
As #Sujay already mentioned you cannot download a file to a local folder using Google AppScript because GAS runs server-side.
You have already taken a good step with the code to save the attachment as a file to your Google drive.
To answer your sub-question 'is it possible to create a google script to auto download file from google drive?', you do not need a script to do that, that is what the Google Drive Desktop App (https://www.google.com.ng/drive/download/) does exactly.
It syncs all the files you add to your drive to your local-pc. You can also edit Google Drive preferences to sync select folders only, in your case that might be the drive folder referenced in your folder variable.
GAS runs on the server side, and only has access to Google's internal architecture. To save locally it'll need to create some kind of a blob and trigger a download within your browser. not sure if you can do that.

Opening a file on Google Drive directly in a Google Drive App

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.

Search file in other google drives

I have a google drive where am storing few google sheets. My java web application is able to search a file that is present in my own google drive using Javascript API. Is there a way to search for a specific files in other's google drive via code? i will be getting the shareable link to the google drive am supposed to search. can this be done? As far as i checked this is not possible. Also there is no where in google document that says i can search files in other's drive. Kindly someone confirm.
This is an OAuth question, not a GDrive question.
The account that the GDrive API will apply to is determined by the Access Token that it is called with. So, if you can get an Access Token for somebody else's Drive, then you can use that to search their drive. How you would get such a token will depend very much on the details of your use case and the trust relationship.

Upload file in a specified google drive with google drive api

I am using Google Drive REST API. Using this app I can upload the file to Google Drive. But I faced some technical problem.
Is it possible to upload files to a specified Google Drive?
Is it possible to fix the access code of Google Drive?
Yes it's possible.
It is the access token that tells Drive which account it should operate on. So read and understand OAuth and you're good to go.