How to get the owner of the shared drive using GDrive API? - google-drive-api

I want to find the owner of the shared drive items OR the organization name to which the shared drive belongs. How can I do that using GDrive API ?

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

Google Drive API Uses

I am creating one application when users can use his/her drive account to save documents. Can i use Drive API so the users save documents in drive? The users will use my app to upload pdf documents in his/her folder.
Yes you can use the Google Drive api to create, update and delete files on a users google drive account.
You Will need to use Oauth2 to have the user authenticate your application granting it access to their google drive account.
You should be aware that the Google drive api has a number of sensitive and restricted scopes which will make the verification process a little more complicated than it would be otherwise.
What you need to know about Google verification in 2021.

How to know through APIs who created the file in Shared Drive (Team Drive) in Google Drive

All the files in Shared drive (Team Drive) in google drive are accessible by all users who have access to Shared Drive (Team Drive).
When a new file is created in a Shared Drive(Team Drive) by default all the users with access to Shared Drive(Team Drive) will become owners as well.
Question : when we list the files using APIs inside a folder in Shared Drive (Team Drive), how to detect who created the file ?
You can use the Revisions API
So, if you list the revisions of a file specifying revisions/lastModifyingUser, revisions/id in parameter fields, you can retrieve the changes of the file and the corresponding user who modified the file.
Thereby, the first revision ("id": "1") should correspond to the creation / upload of the file and the related lastModifyingUser is the creator of the file.
Additional information:
Listing files, will return a files resource with the properties as specified here - The resource has properties like "owners" or "lastModifyingUser", but unfortunately not "creator"
There is already a feature request asking to implement the option to retrieve the user who added a file to a shared drive. - You can "star" it to increase visibility and thus hopefully sooner implementation
Until then unfortunately you cannot retrieve the file creator without the workaround with the Revisions API

Creating a Team Drive through Drive API from an organization-external account?

Hello all here's my situation, in as simple of terms as possible.
I have the Google Drive API enabled for a Google Cloud Platform project.
A code script belonging to that GCP project is shared with accounts that are external to my G Suite organization.
This script creates Team Drive folders automatically.
When running this script from the external account, a Team Drive is created in the Google Drive to which the script belongs, not in the Google Drive that belongs to the external user.
I would like the Team Drive to be created in the Google Drive that belongs to the external user who is running the script.
I understand that, without using the Advanced Services I could reference the REST API directly, and have the Team Drive created in the proper Google Drive just by differentiating between credentials that are defined uniquely for both Google Drives, but how is this accomplished with this wrapper library?

Google Drive Access Api Issue

I am able to access google drive folder using google drive api but i could not access images and did not get ImageId within folder
If we pass static Access_token then it will be expire after 3000 seconds, So after that what we have to do ? I tried so many thing but did not get proper result, Can anyone help me to access google drive folder children id