The Black Knight Sings

Songs about SharePoint and other adventures by Per Jakobsen


Date: # Monday, July 20, 2009

Title: List Quota and Locklevel of all Site Collections in Farm


Here is another small utility requested in one of the SharePoint newsgroups

It creates a tab delimited list of all the Site Collections in the current farm

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
 
namespace ListQuotas
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Site Coll name\tSite Coll Url\tIs ReadLocked\tIs WriteLocked\tQuota in bytes");
            SPSecurity.RunWithElevatedPrivileges(delegate
            {
                foreach (SPWebApplication webapp in SPWebService.ContentService.WebApplications)
                {
                    foreach (SPSite sitecoll in webapp.Sites)
                    {
                        Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}",
                            sitecoll.RootWeb.Title,
                            sitecoll.Url,
                            sitecoll.ReadLocked,
                            sitecoll.WriteLocked,
                            sitecoll.Quota.StorageMaximumLevel);
                        sitecoll.RootWeb.Dispose();
                        sitecoll.Dispose();
                    }
                }
            });
        }
    }
}

The executable can be found here and the source code here



Monday, July 20, 2009 6:34:20 PM (Romance Standard Time, UTC+01:00)  #    Comments [0]

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way. And all information or programs are without warranty. Use at your own risk


© Copyright 2013 Send mail to the author(s) Per Jakobsen Feed your aggregator (RSS 2.0)