Send Reminder Emails with SLK 1.6 and above

SLK has the built in ability to send reminder emails to learners for assignments, but, there is no built in a way to run this. However, there is a sample project in SLK\Samples\ReminderEmails which will run the functionality. The usage of this is

ReminderEmails.exe <site collection url>

This will then send reminder emails for a site collection using the email settings in slksettings.xml. This is implemented as a console project so needs to run on one of your SharePoint servers and you’ll need to schedule it using Task Scheduler or similar.

I have compiled this for SharePoint 2007, 2010 and 2013 at http://www.salamandersoft.co.uk/downloads/SlkReminderEmails.zip.

The default emails settings of SlkSettings are:

  <EmailSettings ReminderDays="1,7" EmailOnSubmitOff="true">
      <NewAssignment Subject="New Assignment: %title%">
          <slk:Body xmlns=""><p>You have been assigned a new piece of work: <strong>%title%</strong>.</p>
<p>%description%</p>
<p><a href=’%url%’>%url%</a></p></slk:Body>
      </NewAssignment>
      <CancelAssignment Subject="Assignment Cancelled: %title%">
          <slk:Body xmlns=""><p>Assignment <strong>%title%</strong> has been cancelled.</p></slk:Body>
      </CancelAssignment>
  </EmailSettings>

The ReminderDays attribute controls when the reminders are sent. They are sent those number of days before the assignment is due. So if you wanted an email on every day for the 3 days preceding the assignment it would be ReminderDays="1,2,3".

You can also have a AssignmentReminder section to set the subject and body of the email as in NewAssignment and CancelAssignment above. Otherwise the default email settings will be used which are

Subject
    Assignment Reminder : %title%
Body
  <p>Assignment <strong>%title%</strong> is due on %due%.</p>
<p><a href=’%url%’>%url%</a></p>

For anyone interested the code in the console application is very simple, it literally just calls the ReminderEmails object within the SLK project.

        public static void Main(string[] arguments)
        {
            if (arguments == null || arguments.Length == 0 || string.IsNullOrEmpty(arguments[0]))
            {
                Console.WriteLine("You must pass a url of a site collection.");
            }
            else
            {
                try
                {
                    ReminderEmails reminder = new ReminderEmails();
                    reminder.Process(arguments[0]);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }

It would be pretty easy to convert this to a SharePoint timer job.

Richard

I am Managing Director of SalamanderSoft Limited a company devoted to improving IT in education. I am also the project co-ordinator for the open source projects SharePoint Learning Kit and Microsoft Learning Gateway.

Leave a Reply

Your email address will not be published. Required fields are marked *