SharePoint Emails — Setting the email FROM field pt. 1

Changing the from field on emails coming from SharePoint is one of the most requested things I’ve tripped across and while it’s certainly possible to achieve I haven’t found a good blog post showing or explaining how to do it. This post and the one to follow will detail two solutions to accomplish that: the first through javascript using the REST API and the second in a SharePoint 2013 workflow using the call http function.


First, I found this solution here:

function sendEmail(to, cc, bcc, from, body, subject) {
     var siteurl = _spPageContextInfo.webServerRelativeUrl;
     var urlTemplate = siteurl + "/_api/SP.Utilities.Utility.SendEmail";
         contentType: 'application/json',
         url: urlTemplate,
         type: 'POST',
         data: JSON.stringify({
             'properties': {
                 '__metadata': {
                 'type': 'SP.Utilities.EmailProperties'
                 'From': from,
                 'To': {
                     'results': [to]
                 'CC': {
                     'results': [cc]
                 'BCC': {
                      'results': [bcc]
                 '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(data){
              alert('Error in sending email: ' + JSON.stringify(data));

Calling it is pretty easy.

sendEmail(to, cc, bcc, from, body, subject);

Keep in mind that to, cc, bcc and from must be a user like, while body can contain html and subject must be a string.

The next post will show how to achieve the same thing though a 2013 workflow.

Turning Point


I don’t think this post will be useful to anyone other than me but I’m going to include it anyway.

A few changes to this blog:

First: the post are going to be a little more conversational and show interesting things that I think are worth sharing. They will probably be less tutorials and more useful things I’ve discovered.

Second: I’m going to try and post more often, hopefully once a week to once every two weeks for some time.



Console Apps for SharePoint Lists

I recently had a requirement to update a SharePoint list based on a Date and Time field. The list contained two important fields: the Date and Time field called ‘Hire Date’ and a field called ‘Active’. The goal was to update the list item when the ‘Hire Date’ field was equal to today’s date and change the ‘Active’ field to false.

This is simple in a workflow, however, the item was NOT getting updated when ‘Hire Date’ was equal to today so there was no way to trigger the workflow. A simple alternative is a .NET console app that runs every day using Windows Task Scheduler.

The app itself is simple, it uses CSOM to get the values of the item and updates the Active column when appropriate.

There are several advantages to using a console app and  running it on a schedule:

  • It’s easy to parse the values of a list and preform an update
  • I don’t need to do something as unnecessary as pause a workflow on Item Creation to the ‘Hire Date’ and leave it paused for potentially weeks
  • And most importantly, I’m not using a Custom Timer Job. SharePoint Timer Jobs, particularly custom ones, can be resource intensive strains on your SharePoint server. If your SharePoint server is already strained for resources, like ours, console apps are a quick and efficient way to check for and make updates to SharePoint Lists.

SharePoint Online Reports

I recently discovered that in SharePoint Online only some auditing reports are available.

If you want to monitor which users are accessing what the Content Viewing Report is not available in SharePoint Online despite being a link that you can click on and try to generate a report for. The explanation comes from this Microsoft Support article:


Hopefully, the link in SharePoint Online means that it’s coming soon…

There are no lists to show in this view

Recently I stumbled on an interesting problem: I needed to open and modify a list in SharePoint designer. So, I opened the list and found that designer gave a generic “There are no lists to show in this view” message. However, this particular site had over fifty lists that I could clearly see in the UI. The solution, which I found here, was a list that had been deleted was showing up.

As the blog suggest you can use a REST call to your site http:// [sharepoint] / [site] / _vti_bin/listdata.svc which should give you some XML, append a list name to this http:// [sharepoint] / [site] / _vti_bin/listdata.svc/ [list name] and with a little hunting you should be able to find your broken list. I was able to find it by trying to open the list through the browser and see a “This page does not exist” error. From here, the list can be deleted.

Finally, close designer and clear your webcache, reopen designer and you should now be able to open your list in designer.

I believe this may have occurred in our migration from 2010 to 2013. The site in question had several outdated and unused lists that needed to be cleaned up and/or deleted. The link to the list seems to have persisted even though it no longer existed and this prevented designer from open the site correctly.