【发布时间】: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