共享云端硬盘文档,但不会通知用户Google Apps脚本 [英] Share a Drive document without notifying user with Google Apps Script

查看:243
本文介绍了共享云端硬盘文档,但不会通知用户Google Apps脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Apps Script中创建一个工作流程过程,其中Doc从模板生成并与各个用户共享以供审批。脚本会发送一封自定义电子邮件,通知用户文档需要他们的批准,但他们还会在文档存储在用户与您共享文档的用户的用户的每个阶段收到第二封电子邮件。有没有办法禁用这些警报?当您通过云端硬盘手动共享文档时,会出现一个复选框选项,允许您选择是否收到通知。但是,我找不到使用Apps脚本禁用此通知的方法。

我使用 doc.addEditors(users)来共享文档。



非常感谢

解决方案

使用 Google文档 Google SpreadSheets 。您可以使用 DocumentApp SpreadSheetApp 共享您的文档或SpreadSheets,而无需通过电子邮件通知:

DocumentApp

  var doc = DocumentApp.openById('124144')
doc.addEditor('example @ mail .com')。addViewer('example2@mail.com')

SpreadSheetApp

  var spreadSheet = SpreadsheetApp.openById('124144')
spreadSheet.addEditor('example @ mail。 com')。addViewer('example2@mail.com')

但是,如果您正在使用不是文档或SpreadSheets的文档,您必须使用 DriveApp 进行分享,并发送电子邮件通知。


I am creating a workflow process in Apps Script where a Doc is generated from a template and shared with various users for approval. The Script sends a customised email notifying a user that the document requires their approval but they also receive a second email at each stage in the process from the user whose Drive the document is stored in saying "User has shared a document with you". Is there any way of disabling these alerts? When you share a document manually from your Drive, there is a checkbox option that allows you to choose whether or not the user receives a notification. However, I cannot find a way to disable this notification with Apps Script.

I am using doc.addEditors(users) to share the document.

Many Thanks

解决方案

There is a simple solution if you are working with Google Docs or Google SpreadSheets. You can use DocumentApp or SpreadSheetApp to share your Docs or SpreadSheets without email notification:

DocumentApp

var doc = DocumentApp.openById('124144')
doc.addEditor('example@mail.com').addViewer('example2@mail.com')

SpreadSheetApp

var spreadSheet = SpreadsheetApp.openById('124144')
spreadSheet.addEditor('example@mail.com').addViewer('example2@mail.com')

However, if you are working with documents that aren't Docs or SpreadSheets, you must share then using DriveApp and email notification will be send.

这篇关于共享云端硬盘文档,但不会通知用户Google Apps脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆