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?

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..

  • Thanks, Do you think a timer job will be best solution, what about a workflow or Information Management policy? – Medes Sep 26 '13 at 14:54
  • Well you can try Workflows.. but Workflows may not be reliable AFAIK.. Timer job seems the best option ! – Arsalan Adam Khatri Sep 27 '13 at 16:31

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.