Thursday, September 23, 2010

Latest ASP.NET Vulnerability Fix For SharePoint

The latest discovered ASP.Net vulnerability affects SharePoint 2007 & 2010.  The SharePoint Team's blog has the instructions for the temporary fix here:

http://blogs.msdn.com/b/sharepoint/archive/2010/09/21/security-advisory-2416728-vulnerability-in-asp-net-and-sharepoint.aspx

Wednesday, September 22, 2010

Turn on versioning on a site's Document Libraries.

We had a lot of sites that needed to have versioning turned on, here's a simple console app I wrote to do this, you just pass the url of the web as an argument:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace Mirant.Utilities.SiteVersioningActivator
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length != 1)
                throw new Exception("URL of the site is required as a parameter");


            string webUrl = args[0];

            using (SPSite site = new SPSite(webUrl))
            {
                using (SPWeb web = site.OpenWeb())
                {

                    foreach (SPDocumentLibrary docLib in web.GetListsOfType(SPBaseType.DocumentLibrary))
                    {
                        docLib.EnableVersioning = true;
                        docLib.MajorVersionLimit = 5;
                        docLib.Update();
                    }
                }
            }
        }
    }
}