I have created a custom list for vendor management system. Now users wants a remainder emails 4 months, 3 months, 2 months, 1 month before the product expires. Each item has expiration date.

I have SharePoint 2013 foundation only. What are options I have and code please?

  • 1
    You can create Custom timer job which runs every month and check expiration value and sends reminder email accordingly. There are many articles available for creating custom timer job. – Bhaskar Dhone Jan 5 '16 at 15:52
  • @BhaskarDhone Do you have any sample code and article links for this? – James123 Jan 5 '16 at 16:35
  • Added my answers , may be it will help. – Bhaskar Dhone Jan 7 '16 at 8:00

Window Service or Timer Job for this functionality. Timer Job will be running everyday and if the Expiry Date- Today Date is 30 days send a mail. if Expiry Date- Today is 40 day send another mail and so on.

Check Msdn site on how to create Timer job and how to hit SMTP to send emails.


|improve this answer|||||

I've done this sort of thing via an SPD workflow. First capture all your dates in variables within the workflow. Set the workflow to loop once a day (i.e. loop then pause for one day, loop again, etc.) each time checking those variable dates and sending emails accordingly once they equal [Today].

|improve this answer|||||
  • SPD workflow will not work in this scenario. Workflow needs to trigger every day to verify if today is 30 days or not..and so on – Gaurravs Jan 6 '16 at 5:16
  • That's why you use a looping workflow which loops everyday. The question was regarding 2013, so this option should be available. – Nate Jan 6 '16 at 16:06

You need to create custom timer job to achieve this. This article will help you to get started.

public override void Execute(Guid targetInstanceId)

In above method you will write your custom business logic. In your case sending reminder email for product which going to expire. It will start when product is going to expire in 3 months. You can check condition if Today's date and expiry date is less than 3 month it will sends an email. And timer job will run every month.

Next you need to create feature to register this timer job. FeatureActivated will help you to register when feature is activate. For monthly schedule you can use below code

SPMonthlySchedule schedule = new SPMonthlySchedule();
                schedule.BeginDay = 1;
                schedule.EndDay = 1;
                schedule.BeginHour = 10;
                schedule.EndHour = 10;
                schedule.BeginMinute = 45;
                schedule.EndMinute = 59;

This will run timer job on 1st day of every month. between 10.45 to 10.59 time.

Hope this helps !

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.