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}",
cb.DatabaseConnectionString);
Console.WriteLine("Size: {0} Bytes", cb.DiskSizeRequired);
foreach (SPSite s in cb.Sites)
{
Console.WriteLine(" Sites: {0}", s.Url);
}
}
Console.ReadLine();
}}}
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}",
cb.DatabaseConnectionString);
Console.WriteLine("Size: {0} Bytes", cb.DiskSizeRequired);
foreach (SPSite s in cb.Sites)
{
Console.WriteLine(" Sites: {0}", s.Url);
}
}
Console.ReadLine();
}}}
0 comments:
Post a Comment