无法使用Rest API将电子邮件发送到SharePoint 2013中的共享邮箱 [英] Not able to send emails to the Shared mailbox in SharePoint 2013 with Rest API

查看:79
本文介绍了无法使用Rest API将电子邮件发送到SharePoint 2013中的共享邮箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一段代码,我可以发送电子邮件到个人电子邮件ID,但不能发送到组织级别的共享邮箱。 

i have a piece of code in that, i am able to send email to the personal email id but not to the shared mailbox in my organisations level. 

有人可以告诉我是否可以使用SharePoint 2013中的其他API向共享邮箱发送电子邮件。

could someone please tell me if it is possible to send email to the shared mailbox with rest API in SharePoint 2013.

推荐答案

您好,

希望您使用  SP.Utilities.Utility.SendEmail
,试试这个让我知道。

Hope you are utilizing the SP.Utilities.Utility.SendEmail , try this and let me know.

另外请查看共享邮箱,它必须是添加到您的AD的非人员帐户,必须能够接收来自
内部和外部参与者的电子邮件

Also please look at the shared mail box , it must be a non person account added to the your AD must be able to receive emails from internal and external participants

function processSendEmails() {

    var from = 'asad@Example.com',
        to = 'someone@Example.com',
        body = 'Hello World Body',
        subject = 'Hello World Subject';

    // Call sendEmail function
    //
    sendEmail(from, to, body, subject);
}


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
类型
" POST"
数据
JSON stringify ({
'properties ' {
'__元数据' {
'type' 'SP.Utilities.EmailProperties'
},
'从' 来自
'到' {
'结果' [ ]
},
'身体' 身体
'主题' 主题
}
}),
header
{
"接受" " application / json; odata = verbose"
" content-type" " application / json; odata = verbose"
" X-RequestDigest" jQuery " #__ REQUESTDIGEST" )。 val ()
},
成功
功能 data < span class ="pln"style ="margin:0px;填充:0像素;边框:0像素;字体风格:继承;字体变:继承;字体重量:继承;行高:继承; FONT-FAMILY:继承;垂直对齐:基线;颜色:#303336"> {
alert
'Email Sentuedfully' );
},
错误
功能 err < span class ="pln"style ="margin:0px;填充:0像素;边框:0像素;字体风格:继承;字体变:继承;字体重量:继承;行高:继承; FONT-FAMILY:继承;垂直对齐:基线;颜色:#303336"> {
alert
'发送电子邮件时出错:' + JSON stringify err ));
}
});
}
.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)); } }); }


document )。 准备好 function () {

SP
SOD executeFunc 'sp.js' 'SP.ClientContext' processSendEmails );

});
(document).ready(function () { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', processSendEmails); });


这篇关于无法使用Rest API将电子邮件发送到SharePoint 2013中的共享邮箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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