Send Email in SharePoint Hosted App without using VS workflow -


I created a SharePoint hosted app that uses the Visual Studio workflow to send emails within the same domain.

Since I am in the process of migrating custom ASPX forms in SharePoint Online in SP2010, each form has been redesigned as an SP hosted app and I want to send emails every time. Do not want to include the workflow.

Any other workaround for handling email in SP's hosted app?

Thank you!

You can use the Javascript Rest API to send emails from the hosted app. See the code below:

var urlTemplate = SPAppWebUrl + "/_api/SP.Utilities.Utility.SendEmail"; $ .Azax ({contentType: 'application / json', url: url template, type: "post", data: JSON.stringify ({'properties': {' __metadata ': {' type ':' SP.Utilities. EmailProperties' 'from: to, from': '' 'Results': [to]},' body ': email body,' subject ': subject}}), header: {"accept": "Application / Jason ("#__ REQUESTDIGEST"). $ Val ()}, success: function (data) {// console .log ('success') warning ('send email successful.');}, Error: work (error) {//console.log(JSON.stringify(err)); Alert (JSON.stringify (err));}});

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -