Sharable Link Trigger

October 12, 2017Productivity, Work Toolstriggers, link sharing, google apps script, automation, properties service

Sometimes you want to share a document with an entire class and let everyone have edit permissions. However, what if you want to revoke those permissions at a specific time? Easy as pie with just a few lines of code.

My friend Gretchen Orwig suggested this project and luckily I was able to write it pretty quickly. Just open the script editor in any document that you want to set the triggering system in. Then just copy in the code below and create a project trigger as in my video!

function removeSharing() {
  var id = SlidesApp.getActivePresentation().getId();
  var file = DriveApp.getFileById(id);

  file.setSharing(DriveApp.Access.DOMAIN_WITH_LINK, DriveApp.Permission.VIEW);

Let me know on twitter what you think! Do you have any ideas for ways to incorporate code into your G Suite for Edu projects? Share them with us!

jordan rhea

Jordan Rhea - I’m a front-end web developer. Follow me at @rheajt if you want to talk, discuss, or fix any of my code! I am passionate about using JavaScript in Google projects, but there are many more applications. I want to learn them all.