Create and manage labels for your Drive files and folders with the Google Drive Labels advanced service. With this advanced service, you can use all the features of the Drive Labels API in Apps Script.
To apply or remove Drive labels, use the Advanced Drive Service.
Reference
For more information about this service, see the documentation for the Google Drive Labels API. Like all advanced services in Apps Script, the Drive Labels API service uses the same objects, methods, and parameters as the public API.
To report issues and find other support, see the Google Drive Labels API support guide.
Sample code
The sample code below uses version 2 of the API.
List labels
The following code sample shows how to get a list of labels available to the user making the request.
Get a label
The following code sample shows how to get a single label by its resource name (which is the string value of the label). To find the label name, get the list of labels through the API or use the Drive labels manager. For more information on the labels manager, go to Manage Drive labels.
List labels for a Drive item
The following code sample shows how to get a Drive item and list all labels applied to that item.