【问题标题】:Sharepoint permissions to send mail with javascript使用 javascript 发送邮件的 Sharepoint 权限
【发布时间】:2018-09-30 04:30:57
【问题描述】:

我正在使用它来发送电子邮件

function sendEmail(from, to, body, subject) {
//Get the relative url of the site
var siteurl = _spPageContextInfo.webServerRelativeUrl;
var urlTemplate = siteurl + "/_api/SP.Utilities.Utility.SendEmail";
$.ajax({
    contentType: 'application/json',
    url: urlTemplate,
    type: "POST",
    data: JSON.stringify({
        'properties': {
            '__metadata': {
                'type': 'SP.Utilities.EmailProperties'
            },
            'From': from,
            'To': {
                'results': [to]
            },
            'Body': body,
            'Subject': subject
        }
    }),
    headers: {
        "Accept": "application/json;odata=verbose",
        "content-type": "application/json;odata=verbose",
        "X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
    },
    success: function(data) {
        alert('Email Sent Successfully');
    },
    error: function(err) {
        alert('Error in sending Email: ' + JSON.stringify(err));
    }
});

}

当我与一个管理员用户一起尝试时,这有效,但是具有贡献权限的“标准”用户收到以下错误:

"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}

我将电子邮件直接发送到用户地址,而不是发送到群组地址。 我已将此添加到贡献权限,但仍然没有成功:

Use Remote Interfaces  -  Use SOAP, Web DAV, the Client Object Model or SharePoint Designer interfaces to access the Web site.

我不知道我还能尝试什么,

有什么帮助吗?

谢谢

【问题讨论】:

    标签: javascript email permissions sharepoint-online


    【解决方案1】:

    贡献权限级别没有“发送提醒”权限。

    添加该权限后,我工作了

    【讨论】:

      【解决方案2】:

      您是否将电子邮件发送给其他 SharePoint 用户?

      此方法仅支持向有效的 SharePoint 发送电子邮件 用户电子邮件地址。

      发件人:https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.utilities.sputility.sendemail.aspx

      【讨论】:

      • 已解决。这是一个权限问题
      猜你喜欢
      • 1970-01-01
      • 2012-04-27
      • 2018-11-08
      • 1970-01-01
      • 1970-01-01
      • 2014-09-13
      • 1970-01-01
      • 1970-01-01
      • 2013-02-21
      相关资源
      最近更新 更多