Skip to content

Instantly share code, notes, and snippets.

@yvan33
Created March 8, 2017 19:22
Show Gist options
  • Save yvan33/946ff68135f3d490823d56bc5e2e9e6e to your computer and use it in GitHub Desktop.
Save yvan33/946ff68135f3d490823d56bc5e2e9e6e to your computer and use it in GitHub Desktop.
function autoExpire() {
var asset;
var user;
try {
asset = DocumentApp.getActiveDocument();
user = Session.getActiveUser();
// Removes the user from the list of editors for the document.
asset.removeEditor(user);
} catch (e) {
Logger.log(e.toString());
}
}
function onOpen() {
var expireIn = 10000; //ms
ScriptApp.newTrigger('autoExpire')
.timeBased()
.after(expireIn)
.create();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment