.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Programmatically Enable Item Scheduling in SharePoint 2010

Posted By:Vijai Anand. R       Posted Date: May 14, 2011    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we will be seeing how to enable item scheduling in SharePoint 2010.
 

Go to Shared Documents=> Library Settings => General Settings => Manage Item Scheduling.


EnableItemScheduling.png


Programmatically enable scheduling of items in the list:

using
System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.SharePoint;

using Microsoft.Office.DocumentManagement.MetadataNavigation;

using System.Reflection;

 

namespace EnableItemScheduling

{

    class Program

    {

        static void Main(string[] args)

        {

            using (SPSite site = new SPSite("http://serverName:1111/"))

            {

                using (SPWeb web = site.RootWeb)

                {

                    SPList list = web.Lists.TryGetList("Shared Documents");

                    list.EnableModeration = true;

                    list.EnableMinorVersions = true;

                    list.Update();

                    typeof(Microsoft.SharePoint.Publishing.ScheduledItem).GetMethod("RegisterSchedulingEventOnList", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { list });

                }

            }

        }

    }

}


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend