Scenario:
You are using calculated columns in your list and you have reference to Today.
Solution:
Run a nightly job
Code:
using Microsoft.SharePoint;Application Configuration File:
using System.Configuration;
namespace UpdateSPList
{
class Program
{
static void Main(string[] args)
{
using(SPSite site = new SPSite(ConfigurationManager.AppSettings["Site"])) {
using(SPWeb web = site.OpenWeb()) {
SPList list = web.Lists[ConfigurationManager.AppSettings["List"]];
web.AllowUnsafeUpdates = true;
foreach (SPListItem item in list.Items)
{
item.SystemUpdate();
}
web.AllowUnsafeUpdates = false;
}
}
}
}
}
<?xml version="1.0" encoding="utf-8" ?>Article:
<configuration>
<appSettings>
<add key="Site" value="http://My_Portal/Sites/TheSite"/>
<add key="List" value="Tasks"/>
</appSettings>
</configuration>
0 comments:
Post a Comment