Hello,
I'm writing a script to audit our shared drives.
I use "Drive.Drives.list()" to get the drives, but I can't find in the API how to get the "shared drives parameters", is there a way to do it ?
--> my google is in french, i'm not sure that the words "shared drives parameters" are completely correct, i want to get parameters from the popup you get when you "right click" on a shared drive", and select the 3rd option "Parameters of the shared drive", or something like that
Olivier
Update:
Here is my current code
function audit_MySharedDrives() {
var drives=getSharedDrives()
drives.forEach(function(d) {
console.log(d.getName())
// get drives properties ???
})
function getSharedDrives() {
//source: https://yagisanatode.com/get-a-list-of-google-shared-drives-by-id-and-name-in-google-apps-script/#Displaying_more_than_10shared_drives
let sharedDrives = Drive.Drives.list()
let sharedDrivesItems = sharedDrives.drives
// If a next page token exists then iterate through again.
while(sharedDrives.nextPageToken){
sharedDrives = Drive.Drives.list(
{
pageToken:sharedDrives.nextPageToken
}
)
sharedDrivesItems = sharedDrivesItems.concat(sharedDrives.drives)
}
return sharedDrivesItems
}
I have advanced since I post my message.
On another web site I've found that I can add the parameter "fields=*" to the command "Drive.Drives.list()" (the API documentation is really NOT good !!!)
And now I can see data in the "restrictions" property, now I need to figure out the values.
My updated code :
function audit_MySharedDrives() {
var drives=getSharedDrives()
drives.forEach(function(d) {
console.log(d.getName())
// get drive properties
const restrictions=d.getRestrictions()
console.log("restrictions", restrictions)
/*
"restrictions" contains following properties :
sharingFoldersRequiresOrganizerPermission
adminManagedRestrictions
driveMembersOnly
domainUsersOnly
copyRequiresWriterPermission
*/
})
function getSharedDrives() {
//source: https://yagisanatode.com/get-a-list-of-google-shared-drives-by-id-and-name-in-google-apps-script/#Displaying_more_than_10shared_drives
let sharedDrives = Drive.Drives.list(
{
fields:"*"
}
)
let sharedDrivesItems = sharedDrives.drives
// If a next page token exists then iterate through again.
while(sharedDrives.nextPageToken){
sharedDrives = Drive.Drives.list(
{
fields:"*",
pageToken:sharedDrives.nextPageToken
}
)
sharedDrivesItems = sharedDrivesItems.concat(sharedDrives.drives)
}
return sharedDrivesItems
}
Hi @ogouret I have a similar implementation of what you are trying to achieve here: https://github.com/doitintl/DoiT-AdminPulse-for-Workspace/blob/main/getSharedDrives.gs.
It looks like you want to list the restrictions object and booleans from each shared drive.