問題描述
我正在 Apps Script 中創(chuàng)建一個工作流程,其中從模板生成文檔并與各種用戶共享以供批準(zhǔn).該腳本會發(fā)送一封定制的電子郵件,通知用戶該文檔需要他們的批準(zhǔn),但他們還會在流程的每個階段收到第二封電子郵件,該電子郵件來自存儲該文檔的驅(qū)動器的用戶,其中說用戶已與您共享文檔".有沒有辦法禁用這些警報?當(dāng)您從云端硬盤手動共享文檔時,有一個復(fù)選框選項可讓您選擇用戶是否收到通知.但是,我找不到使用 Apps 腳本禁用此通知的方法.
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.
我正在使用 doc.addEditors(users)
來共享文檔.
I am using doc.addEditors(users)
to share the document.
非常感謝
推薦答案
如果您使用 Google Docs 或 Google SpreadSheets,有一個簡單的解決方案.您可以使用 DocumentApp 或 SpreadSheetApp 共享您的文檔或電子表格,而無需電子郵件通知:
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')
電子表格應(yīng)用程序
var spreadSheet = SpreadsheetApp.openById('124144')
spreadSheet.addEditor('example@mail.com').addViewer('example2@mail.com')
但是,如果您使用的文檔不是 Docs 或 SpreadSheets,則必須使用 DriveApp 進(jìn)行共享,并且將發(fā)送電子郵件通知.
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.
這篇關(guān)于使用 Google Apps 腳本在不通知用戶的情況下共享云端硬盤文檔的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!