【问题标题】:How to change google docs file owner without sending an email notice to the new owner如何在不向新所有者发送电子邮件通知的情况下更改 google docs 文件所有者
【发布时间】:2020-12-22 17:45:59
【问题描述】:

我正在使用 Drive API 和 Google Apps Script UrlFetchApp 来更改文件所有者。它工作得很好,它会为每个文件向新所有者发送电子邮件通知。如何隐藏此电子邮件通知?

这是我的部分代码sn-p

var base = 'https://docs.google.com/feeds/';
var fetchArgs = googleOAuth_('docs', base);
fetchArgs.method = 'POST';

var rawXml = "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gAcl='http://schemas.google.com/acl/2007'>"
+"<category scheme='http://schemas.google.com/g/2005#kind' "
+"term='http://schemas.google.com/acl/2007#accessRule'/>"
+"<gAcl:role value='owner'/>"
+"<gAcl:scope type='user' value='"+newOwnerEmail+"'/>"
+"</entry>";

fetchArgs.payload = rawXml;
fetchArgs.contentType = 'application/atom+xml';
var url = base + encodeURIComponent(oldOwnerEmail) + '/private/full/'+fileOrFolderId+'/acl?v=3&alt=json';
var content = UrlFetchApp.fetch(url, fetchArgs).getContentText(); 

【问题讨论】:

    标签: google-apps-script google-drive-api


    【解决方案1】:

    您必须在请求中添加sendNotificationEmails=false才能修改文件的权限

    【讨论】:

    • 谢谢它现在正在工作,例如不再发送不需要的电子邮件。附:我意识到我正在使用 docs.google.com,所以我不得不使用 send-notification-emails=false
    猜你喜欢
    • 2018-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-15
    • 1970-01-01
    • 2012-10-11
    相关资源
    最近更新 更多