I have a Google Apps script that belonged to a former colleague. They have been offboarded and the script currently has No Owner. I am curious how long this GScript will exist without an owner assigned.
The user has been deleted since May and we have a backup.
Based on the fact that you can restore a user within the first 20 days of being deleted and a file can be restored within the first 25 days of being deleted (if the user still exist) I would say it will remain available 20 days. After that it will be permanently deleted and cannot be restored or transfer, I would suggest to make a copy of the file.
You can check these G Suite Administrator Help Center Articles to have more details about how Google manage deleted users and files.
Restore a recently deleted user
Restore deleted files or shared drives
Restore a deleted user's Drive files
UPDATE:
After checking the image well, I can see that the file is within a Shared Drive or "Team Drive" if that is the case according to "Store & share files with shared drives".
Members of a shared drive share ownership of any files and folders.
If someone leaves the shared drive, any files they added will stay.
You can still share files with a link or invite.
That means if the user is deleted (leaves the share drive) the file added will stay, so it will be forever. And the Shared Drive cannot be deleted if contains files, if someone wants to delete the Shared Drive they must delete the files first.
I just wanted to follow this up as I found a bug on Google Issue Tracker which shows that if a user is deleted while they own some scripts that are bound to Drive files, upon user deletion even if the Drive files are transferred to another user on the domain the owner doesn't change and the scripts can become inaccessable. Make sure that in the future all scripts are copied or saved in a shared Drive so that they can be accessed on user account deletion/migration.
Related
How can I transfer all my files from a google drive account to another google drive account, but from different domain and organisation.
I tried with Transfer Ownership, but I recieve an error when I choose to which user I want to transfer the files.
"Error: Select a user from search results"
Transfer of Ownership with Google Drive
It would be important to clarify at first what is possible and the workarounds. First we need to make sure that your organization has enabled the option to share files with outside users or make it public.
The [transfer of ownership][1] is only available or allowed between users from the same organization.
Method 1 (Make a Copy)
The first method that I suggest is to move all data to a folder from your Drive and share that folder directly with the other user. For example the folder would be under user "A" and you would share it with the user from another domain, the user "B".
Login to with user "B" and check under "Recent" option over, it should be on the left of the Drive UI.
You should be able to access the folder that was recently shared or with the link of the folder (I suggest having the user "B" account under an incognito window). You can start from there picking the files and making a copy, the copy would be under the ownership of user "B".
Method 2 (Shared Drives)
If your new organization or domain has Shared Drives, you should be able to add the external users as "Manager", you would need to add user "A". This way the user "A" would be able to move files directly to the Shared Drive, and due to the Shared drives not having owners but "Managers" or other permissions, the file becomes part of the new organization and is available to be moved by the users of the new organization.
Method 3 (Google Takeout)
If none of these options helps you, you can utilize Google Takeout to download all your Google Data.
You can review how it works below:
https://support.google.com/accounts/answer/3024190
References
https://support.google.com/a/answer/7374057
https://support.google.com/drive/answer/2375091?hl=en&co=GENIE.Platform%3DDesktop#zippy=%2Cmake-a-copy-of-a-file
[1]: https://support.google.com/a/answer/1247799?hl=en
In addition to Ricardo's full answer:
Method 2b (automated)
Even if your Google Workspace has no Shared Drives you might use this method with Google Drive add-on or web-app.
Scenario
There are many files in a Google (Team) Drive, all of which are nested in folders
All of these folders and their files are deleted by mistake.
In an attempt to recover the data, the Restore button on the Web UI is used
The Restore button in the Web UI does not seem to care about the order, and restores files before restoring the folders that contained them.
Thousands of files end up in the root directory of the drive since their folders "don't exist" when being restored from Trash.
What I need:
How can I recover the information about where the files used to reside, in order to patch this correctly?
What I tried:
Get all of the revisions for one of the files in question with Revisions: list and see there is only 1 result.
Get the revision information for that revision with Revisions: get
Realise that the revision information contains nothing about parents.
Get the file information with Files: get
Confirm that the head revision meta matches the only revision found in step 1
See that the file meta shows the parent is the root.
I can't find a way of determining what the original folder was for the trashed and incorrectly restored file.
After further investigation I don't think it is possible to recover the information about the previous parents from the Google Drive API v3.
However, if you are using Google Team Drive, as part of the G Suite, you should have access to the G Suite Admin SDK Reports API unless you are on a G Suite Basic account. With that you can use Activities: list with various filters to pull back the information about where the orphaned files came from.
I have published my solution here: Google Team Drive Orphaned File Restorer
This console application can pull a list of Google Drive file movements between two points in time, optionally filtered by the IP Address of the user who made the changes (i.e. restored the files from trash). It will then use that information to re-parent the files in question. You can do a dry run to see what the changes will be before you actually commit.
I shared a folder containing files and subfolders with files with multiple users and gave them edit permissions. One users account has modified the viewing ability(?) of every file and subfolder they had access to. From my account when I open the top level folder I see it empty but I know these files are still there because I own the majority of them and my drive storage amount hasn't changed.
The user claims they have no idea how it happened so maybe that it was an app they unknowingly gave drive access to?
Is there any way I can fix this from the Google Drive web interface? I found Google Apps Scripts has access to the Drive API, should I find a script that can mass change the permissions?
Only the owner can delete the file.
The files were removed from the folder but were not deleted.
Therefore, they take up disk space.
To view files outside the folder, follow these steps:
https://drive.google.com/drive/search?q=is:unorganized%20owner:me
Excuse my bad English
Venca
A non-privileged Google Drive user has accidentally removed a large number of files from folders shared across an organisation. They do not have permission to delete the files entirely, because they are not the owner. However, users with edit permissions are able to remove a file from a shared folder. This returns the user to the owner, but seems to leave the file orphaned without a parent folder.
The files were owned by various different users.
How do I restore these files to their correct folders? The Google Drive Audit Log does not contain enough information to restore the folders correctly - the parent folder ID is not included with the "Remove from folder" event.
Google Drive is included in the Reports API of the Google Apps Admin SDK. It provides similar information to the Google Drive Audit Log, but with additional metadata. That includes the parent folder ID of files which were removed.
To restore the files you should first query the Reports API for files removed by the user in question over the relevant time period, using the Activities:list method.
Then you'll need to setup a Google Apps service account (which is a little confusing), to allow you to impersonate the owners of the documents that were removed.
Lastly, you can iterate over the event report for the removed files and use the Files: patch method in Google Drive REST API, to re-add the parent ID's to each of the files.
See Gist Using Google Drive API to restore files removed from shared folders
for example of the last step.
Does anyone know if it would be possible to set up a script on my Google account that triggers when a new item is shared to the email and then automatically shares it with another email address?
I use a personal Gmail account, but whenever I do school work documents are always shared with my school email and it is a pain to have to share everything manually or keep switching accounts.
When I looked a few weeks back I was unable to find a way to have a script trigger on new shared items, but I am new to these scripts so if anyone has a suggestion I would appreciate it. Thanks!
I don't think you can actually triggers on new items. But you can write a script to read the Drive feed to easily check if there's new files.
Such script would still have to be triggered on a time-driven basis, so you wouldn't have "instant" access on your second account. Also, if I'd write such script, I would just create a folder, share it with the desired accounts, then use the script just to move the files to this folder. This approach has the benefit of easily allowing you to check which files are shared (with your specific account) and which aren't. And since folders are actually just labels in Drive, it is not any problem if you like or need to have your files organized in another folder structure.
By the way, have you seen Chrome users feature? It helps a lot when working with multiple accounts.