I know its possible to schedule pages for publication in SharePoint 2007. Is it also possible to do this for listitems?
For example, a list of links to news stories. Could these be scheduled for future publication? If so, how?
I know its possible to schedule pages for publication in SharePoint 2007. Is it also possible to do this for listitems?
For example, a list of links to news stories. Could these be scheduled for future publication? If so, how?
You could run a Windows Service or a scheduled task to push list items to the SharePoint site on the desired schedule using the object model or the lists web service.
You could add a "publication date" field in your list (assuming it's a list you can add fields to) and then modify your list view to only show items for which the publication date is in the past.
Just modify the section of you schema.xml to something like :
<Query>
<Where>
<Leq>
<FieldRef Name='publication_x0020_date'/>
<Value Type='DateTime'>
<Today />
</Value>
</Leq>
</Where>
</Query>
You can create a field in your list, say PublishDateTime, and whenever you add an item to the list, set the future PublishDateTime for it. Then you can use a SharePoint Timer job to keep looking at the list at fixed times and change the item state from say Hidden to Published based on the PublishDateTime. The Microsoft.SharePoint.Administration.SPJobDefinition
class is used to do this. Override the execute method of this class and write your code in it.
public class PublishingJob : SPJobDefinition
{
//implement the required constructors.
//then override Execute method
public override void Execute (Guid Id)
{
//get current list from web
foreach(SPListItem item in SPList.Items)
{
if(item.PublishDateTime <DateTime.Now)
{
item["Published"] = 1;
}
}
}
}
See detailed example at Andrew Connells blog