Monday, December 20, 2010

DocsList, Notifications and Performance

Have you ever wondered how you can manage permissions of your Files and Folders (aka DocsList) in bulk using Apps Script? And at night, when you are about to go sleep, have you wondered if your script is failing? And you must have wished if your script could run a bit faster. If yes, then we have three really good pieces of news to share with you.

Today, we are enhancing features in DocsList Services, introducing Notification of failed events and increasing the performance of Apps Script when they use other Google services.

Enhancements to DocsList Services
DocsList Services in Google Apps Script provides a powerful API to manage user’s documents list - this week we’re adding functionality to modify file and folder permissions. We’ve added methods to Add and Remove permissions for both editing and viewing.

Why is this important? Two very interesting uses of this functionality are:
  1. Ability to automate changes to File permissions based on logic in your script.
  2. Ability to make file permission changes in bulk (since we needed to give a break to administrators!!).

These new methods are very easy to implement as you only need to provide an array of Users or Email Addresses and you are done! For example:

// Get all VIEWERS of a File or Folder

Folder myFolder = DocsList.getFolder("myFolder");

File myFile = myFolder.getFiles()[0];

User[] fileViewers = myFile.getViewers();



// Similarly you can make permission changes in bulk



Notification of Failed Events
Most of you love and use Triggers for periodic execution of your scripts. We have now gone a step further by allowing you to configure Notifications when your scripts fail. You can setup a periodic email notification which will aggregate failures events thrown by your scripts and email it back to you. This is a really cool feature which will let you sleep at night!.

Increased Performance in accessing other Google Services
The fun thing about Apps Script is that it is an easy way to integrate various Google services like Contacts, Calendar, DocsList and Sites. We have just made this integration a lot more fun. Performance in communicating to these various Google Services has been optimized so that your scripts that access these services can run faster. Services like DocsList can be executed up to 3x faster. A big thanks to the team for that!

Saurabh Gupta, Developer Relations, Google Apps Script