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

Top 5 Contributors of the Month
Gaurav Pal

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

 Subscribe to Articles

Content Database Size in SharePoint

Posted By:Jean Paul       Posted Date: July 17, 2014    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we have explored How to find content database size in SharePoint

In this article we can explore, how to find the content database size - manually & programmatically.

Server Object Model

In the SharePoint Server Object Model, there is SPWebApplication.ContentDatabases property to fetch the databases within web application.

For the database, we can use the DiskSizeRequired property to find the size.   This property actually represents the database backup need size.


Following is the code which performs the following:


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

namespace ContentDatabaseSize
    class Program
        static void Main(string[] args)
                SPWebApplication webApplication = SPWebApplication.Lookup(new Uri("http://hp"));
                if (webApplication != null)
                    foreach (SPContentDatabase cd in webApplication.ContentDatabases)
                        Console.WriteLine(cd.DisplayName + " " + cd.DiskSizeRequired);



The size divided by 1024 * 1024 gives size in MB.  It is around 60 MB.

Verification with Database

You can go to SQL Server Management Studio to verify the database size. Select Properties menu item for the database.


Please see the property Size as shown below.



In this article we have explored How to find content database size.

 Subscribe to Articles


Further Readings:


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