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.
Thank You Very Much For Your Time