码迷,mamicode.com
首页 > 其他好文 > 详细

sharepoint rest 脚本发送邮件

时间:2017-11-17 16:16:23      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:func   relative   fun   cli   request   app   poi   site   .so   

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, 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).ready(function () { SP.SOD.executeFunc(‘sp.js‘, ‘SP.ClientContext‘, processSendEmails); });

sharepoint rest 脚本发送邮件

标签:func   relative   fun   cli   request   app   poi   site   .so   

原文地址:http://www.cnblogs.com/olay/p/7851571.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!