In this article we will be seeing how to schedule an item in SharePoint 2010. An item can be scheduled so that item is visible on the site only between the scheduled start date and end date. An item will be scheduled to be automatically approved (Status-Approved) and to be unpublished (Status-Draft) on specified dates.
Before scheduling the item go to the Library Settings => Add from existing site columns => add the following columns.
static void Main(string args)
using (SPSite site = new SPSite("http://serverName:1111/"))
using (SPWeb web = site.RootWeb)
SPList list=web.Lists["Doc Library"];
SPListItem listItem = list.GetItemById(1);
ScheduledItem scheduledItem = null;
scheduledItem = ScheduledItem.GetScheduledItem(listItem);
throw new System.ArgumentException ("SPListItem must support scheduling", "listItem");
DateTime startDate = new DateTime(2011, 4, 6, 22, 50, 00);
DateTime endDate = new DateTime(2011, 4, 6, 22, 51, 00);
scheduledItem.StartDate = startDate;
scheduledItem.EndDate = endDate;
Once the item is scheduled you could see the approval Status as "Scheduled".
If the start date is earlier than the current date, the item is published immediately and Approval Status will become "Approved". If not, it is scheduled to publish at a future date.
If the end date is specified, the item is scheduled to unpublished and the Approval Status will become "Draft "at a future date.