SharePoint has a cool and great facility called Quota templates. In order to get this facility in UI, you have to do the following. Refer: http://technet.microsoft.com/en-us/library/cc263223.aspx
Enable the site collection quotas in the central administration site – under application management.
Once you click on the “site collection quotas and locks” you will be redirecting to another page and there you can set your quota template and lock status.
Once you enable this one, then you can see a new link under the site collection administration section of your site.
Once you click on that link it will redirect to another beautiful page which is given below.
In the above page we can see all document libraries, documents and lists by selecting the “show only” drop down. Also here we can filter the result using the “Show items” drop down and also we can sort the list items using “Sort By” drop down.
The list will show the name of the list or library and the corresponding size and related information. Now we can see how we can retrieve this information through code. The below code is self explanatory and I believe it won’t confuse you any more J
We can go with the code if you want to create a custom view representation of this detail. Also it will help us if you want to get this information anywhere in your custom application.
1: SPSite oSite = new SPSite("http://blr3r7-19c:13774/sites/testwp");
2: DataTable oDtRawData = null;
3:
4: // this line of code will return the stroage information of all the document lirbaries in this site
5: oDtRawData = oSite.StorageManagementInformation(SPSite.StorageManagementInformationType.DocumentLibrary,SPSite.StorageManagementSortOrder.Increasing, SPSite.StorageManagementSortedOn.Size,100);
6:
7: // this line of code will return the stroage information of all the lists in this site
8: oDtRawData = oSite.StorageManagementInformation(SPSite.StorageManagementInformationType.List, SPSite.StorageManagementSortOrder.Increasing, SPSite.StorageManagementSortedOn.Size, 100);
9:
10: // this line of code will return the stroage information of all the Documents in this site
11: oDtRawData = oSite.StorageManagementInformation(SPSite.StorageManagementInformationType.Document, SPSite.StorageManagementSortOrder.Increasing, SPSite.StorageManagementSortedOn.Size, 100);
12:
13: // if you wan to see column names, loop through all the columns and find out the names and grab the needed one.
14: foreach (DataColumn oColumn in oDtRawData.Columns)
15: {
16: Console.WriteLine(oColumn.ColumnName);
17: }
18: Console.ReadLine();
19:
20: // loop through all the rows and find out the values. Here the size will be return in bytes (size/1024 = size in KBs)
21: foreach (DataRow oRow in oDtRawData.Rows)
22: {
23: Console.WriteLine(oRow["Title"].ToString() + " : " + oRow["Size"].ToString() + " : " + oRow["LeafName"].ToString());
24: }
25:
26: Console.ReadLine();
'Solution Platform' 카테고리의 다른 글
Important point need to remember while working with DateTime filtering values in FullTextSqlQuery (0) | 2010.03.30 |
---|---|
Word 2007: How to hide document properties panel from SharePoint server (0) | 2010.03.19 |
Custom Site Template 간단하게 만들어 보자.. (0) | 2009.11.17 |
SharePoint Crawling - Invalid UTF-8 Encoded Characters Error (0) | 2009.10.08 |
FullTextSqlQuery를 이용한 검색 샘플 소스 및 주의 사항 (0) | 2009.09.21 |