What's the difference between SPSite.UsageInfo.Storage and SPSiteAdministration.DiskUsed?

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/17725

  •  16-10-2019
  •  | 
  •  

Pergunta

i want to create a PowerShell-script that can list the actual size of a SharePoint site-collection (among other infos) and export that to CSV.
Writing that script i discovered that there's more than one way to get the "size" of a site-collection:

  1. SPSite.UsageInfo.Storage
    "Contains the total amount of storage in bytes that is consumed by the site collection" http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.usageinfo.storage.aspx
  2. SPSiteAdministration.DiskUsed
    "Gets a value indicating the amount of disk space used by the site collection"
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spsiteadministration.diskused.aspx

In my experience the SPSiteAdministration.DiskUsed is larger than the SPSite.UsageInfo.Storage in most cases, while sometimes they both return the same value.

So, can somebody explain what exactly the difference is ?

Foi útil?

Solução

I +1'd Anders answer because it's the right way to approach what you want to do, but to your point it doesn't address your question of what's the different between "amount of storage in bytes" and "amount of disk space used".

There's two possible reasons for this as I see it:

1) UsageInfo is calculated real-time, as data is added or removed from a site collection. Whereas I believe DiskUsed is calculated at a set interval as part of a maintenance job.

2) UsageInfo may not count items in the stage 2 recycle bin, as they are not counted towards quotas. Only items in the stage 1 recycle bin are counted towards quotas.

Outras dicas

Take a look at the SPSite.Usage property

Todd Klindt have an example of a script that does close to what you want here.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top