Add a shared folder to google drive using a share link - google-drive-api

Newest Edit:
So here is what i want to accomplish:
1) User installs my application on his computer.
2) User grants my app access to his drive.
3) My app shares a folder from my drive with the user.
The problem in accomplishing part 3) is that my app actually needs write access to my drive, so it can share my folder with the current user. But for security reasons there is no way i can grant my app write acces to my drive.
Now im asking for a possibility to perform part 3) without granting my app write access for my drive.
I would like my installed application to add a shared folder to a users google drive account by only using a share link i generated manually for a folder i've created in my drive. Is it possible to accomplish this using google drive API?
Edit: What i actually want to do is to create a folder in the users drive and link this folder to a folder in my drive, so the user can access the files stored in my drive.

A shortcut to another's shared directory? Google Drive doesn't support it but, you can create an application to handle it.
Create a shortcut to your application.
Add the the link you want your user to be redirected as a custom property to the shortcut file.
When user opens the file from Drive and being redirected to your app, read the custom property you stored.
Redirect user to the the location on the retrieved custom property.

Related

Object level authorisations or ACLs in Google Shared drive

Does Google Shared drive have any object level authorizations or ACLs ?
Currently i only see that there are members of the shared drive and they get apply to all the files and folders in the shared drive.
How do i achieve the following scenario ?
Shared Drive 1
Folder 1
File 1
Folder 2
File 2
I want user A to have access to Folder 1 under Shared Drive 1 and user B to user access to Folder 2. But it seems its not possible in Google shared drive.
Best Regards,
Saurav
You can share a folder under a Shared Drive if you right click on that designated folder and click on the Share Button. Here are a list of scenarios that will happen once it is done:
The user will be notified via email that the folder has been shared.
The user will not have any visibility on the source Shared Drive where that designated folder is located. He will simply have access to the folder and all of its contents.
Another important note to consider for you to be able to achieve this:
Make sure that the Shared drive settings option is set to allow "People who aren't shared drive members can be added to files".
This can be done through the Google Workspace Admin Console under Apps > Google Workspace > Drives and Docs > Manage shared drives. And, on the list of Shared Drives, you should see the settings when you hover over the items on the Shared Drive list.
Reference:
https://support.google.com/a/answer/7662202?hl=en#zippy=%2Crestrict-access-for-an-existing-shared-drive
For further assistance regarding this matter I'd best advise you to contact Google Workspace Support

Save modified google sheet Template to shared drive instead of each user/accessors personal google drive

I am looking to work around the limitation to save an updated template or copy in google sheets to a specified share drive that stores the original file. Could I create a shared drive with all of the users I want to modify the template and put the template in the drive and each of the users access the file and their modifications saved in that shared drive as unique files?
Context: https://support.google.com/docs/thread/22231997?hl=en#
You can create a customized shared drive from the user interface
Go to https://drive.google.com and click on "Shared drives"
Right-click onto the white field and select "New shared drive"
Chose a name and click on "Create"
At the left top, click on "Add members"
Enter the email addresses of the users you want to add and click on "SEND"
Go on "Manage members" and give to each one personalized permissions, if desired
IF YOU WANT TO SHARE YOUR DRIVE PUBLICLY
Unfortunately currently it is not possible to share a drive publicly, however, when you create a file inside the shared drive (or on your drive), you can edit the sharing permission and choose the option that everybody with the link has access to your file. In this case, all you need to do is to share the link with the users.
Keep in mind that the users will not be able to save a copy of the file on the shared drive if they have not been added to the drive.
If you are interested in a Workaround
You can create a Google Form and ask the users to submit their file as an attachment to the Google Form. In this case, all the files will be stored on your drive, once the users submit their forms.

User with edit privileges made files I own not viewable by me

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

Creating a google drive folder on customers account

I am working on an application which requires the automatic creation of a folder on customer's Google Drive accounts as opposed to them creating this themselves.
I will have their permission to do so and won't have access to this folder. Ideally this folder would be encrypted but they could do this afterwards themselves.
Is it possible? And if it, how can I achieve that?
It can be done using the REST API. See the section called Creating a folder.
https://developers.google.com/drive/api/v3/folder

How to setOwner() of file after uploading it to a folder in Drive?

Desired Behaviour
This is my first attempt at a google apps script and I want a user to be able to upload a document to a shared folder (with edit access), but then change the permissions of the file so that the user cannot delete the file and can only view it.
(If this is not specifically possible, I am interested in any method that achieves the same result - ie an admin has edit access to a folder of documents uploaded by users with view only access).
What I've Tried
This answer:
https://stackoverflow.com/a/10821130
Points to a method called setOwner(emailAddress)
So I tried:
// define the target folder to create the file in
var driveFolder = DriveApp.getFoldersByName("My Folder").next();
// create a file in the target folder and set a different owner
var driveFile = driveFolder.createFile(formBlob).setOwner("test#gmail.com");
Current Behaviour
The file ownership is not changing.
Developer Tools > Console error is:
Uncaught ScriptError: Invalid argument: sharing.user
With questions about that particular error here:
Trying to change owner on files in Google Drive
Other Settings
Publish > Deploy as web app > Execute the app as > "User accessing the web app"
Publish > Deploy as web app > Who has access to the app > "Anyone"
According to
Change your sharing settings - Google Drive Help the ownership of uploaded files can't be transferred. For an alternative approach see Google Forms file upload complete example
You have to create a google site and use the upload feature then you can change settings.
Since the file one person directly in google is "not yours" you cannot change it. but if you receive it through a site page you will be the owner.