Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

When every I use SPSite.Usage.Storage and I use SPSite.StorageManagementInformation with to retrieve all the documents for the Site Collection then I sum the sizes of all the documents then I get a different value. For some of my site collections it is Usage.Storage has a greater value and sometimes it has a lesser value. Here is some code to illustrate what I am saying:

SPSite someSiteCollection = new SPSite(someGUID);

//returns lets say it returns 25.09 MB
long storageValue = someSiteCollection.Usage.Storage;

DataTable someDataTable =someSiteCollection.StorageManagementInformation(SPSite.StorageManagementInformationType.Document, SPSite.StorageManagementSortOrder.Decreasing, SPSite.StorageManagementSortedOn.Size, 100000); 

//sums all the items in the table, which the table represents the site collection
object otherStorageValue = someDataTable.Compute("Sum(Size)","");
//lets say this is coming up as 27.05 MB
long otherValueSample = Convert.ToInt64(otherStorageValue);

I am not around my code right now, but that hopefully gives you a good idea of what I am talking about.

My question is why is SPSite.Usage.Storage and StorageManagementInformation returning different values, what is Usage.Storage counting as storage since sometimes it is more and sometimes it is less.

share|improve this question

2 Answers 2

Don't forget the versions... The difference is when using versioning on document libraries this will not counted every where. I changed the difference in the table:

dbo.AllDocVersions

For example:

Site.Usage.Storage gave me the value: 220100000 When I counted every data on every site it returned: 95600000

When I calculated the size of AllDocVersions I get the other remaining size I needed.

share|improve this answer

I noticed this a while back while studying the difference on the size between a single site collection in a content database and the actual database size.With Audit logging turned on in the site collection, the database size will always be bigger than what SharePoint reports in the various tools listed above. This was at least the case in SharePoint 2007.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.