Retrieving Values from Configuration Database Sharepoint

This example is a console application for Retrieving Values from the Configuration Database.

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace GetConfigDatabase
class Program
static void Main(string[] args)
using (SPSite site = new SPSite("http://SPSite"))
SPContentDatabase cb = site.ContentDatabase;

Console.WriteLine("Content Database: {0}", cb.DisplayName);
Console.WriteLine("Connection String: {0}",

Console.WriteLine("Size: {0} Bytes", cb.DiskSizeRequired);

foreach (SPSite s in cb.Sites)
Console.WriteLine(" Sites: {0}", s.Url);


Post a Comment


This is a personal weblog. The opinions expressed here represent my own and not those of my employer or anyone else. Should you have any questions or concerns please e-mail me at .

Copyright (c) 2010 @ All rights are reserved.Do Not Copy.

@ Learning