Tuesday, 15 June 2021

Create a Shared drive

The following Google Apps Script is designed to simply create a Shared drive in Google. It does not add permissions at this stage.

 

Enable Drive API Service

Make sure you have followed the instructions here to enable the Drive API Service.


The Code

First we create a random request ID that uniquely identifies your request for the creation of a Shared drive:

 var requestID = Utilities.getUuid();

Next we provide a name for the Shared drive and format it so the Drive API can read it:

var name = {
  name: 'Shared Drive from Apps Script2'
};

Finally we make the Drive API call to create the Shared drive:

var newSharedDrive = Drive.Drives.insert(name, requestID);


Download

Create a Shared drive download here (please use 'File' > 'Make a copy' for your own version).


No comments:

Post a Comment