0

I have a custom list containing Expire date field. I would like to get an alert (email) 30 days before the expire date for all items in the list. what is the best solution for that?

Medes
  • 2,086
  • 10
  • 60
  • 103
  • See also: http://sharepoint.stackexchange.com/questions/78760/sharepoint-task-list-with-email-alerts – Stu Pegg Oct 04 '13 at 08:45

1 Answers1

1

Write a timer job, which queries the list to get only items for which 30 days are left for expiry... And send alert for all such items!

For querying items you can use range of dates, programmatically add 30 days to current date and than use:

<Query>
  <Where>
    <And>
      <Geq>
         <FieldRef Name="ExpiryDate" />
         <Value IncludeTimeValue="FALSE" Type="DateTime">2011-01-01T15:55:52Z</Value>
      </Geq>
      <Leq>
         <FieldRef Name="ExpiryDate" />
         <Value IncludeTimeValue="FALSE" Type="DateTime">2011-01-31T15:56:29Z</Value>
      </Leq>
    </And>
  </Where>
</Query>

Timer job should run daily, maybe at the end of the day..

Arsalan Adam Khatri
  • 14,531
  • 3
  • 36
  • 59