Not of the site collection itself, but the individual SPWeb's.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You should take a look at this blog entry by Alexander Meijers : Size of SPWeb based on its Folders and Files
It provides a clever way of finding the size of an SPWeb or SPFolder by iterating through his content.
private long GetWebSize(SPWeb web)
{
long total = 0;
foreach (SPFolder folder in web.Folders)
{
total += GetFolderSize(folder);
}
foreach (SPWeb subweb in web.Webs)
{
total += GetWebSize(subweb);
subweb.Dispose();
}
return total;
}
回答2:
For anyone who comes back to this question, here is the missing method:
private long GetFolderSize(SPFolder folder)
{
long folderSize = 0;
foreach (SPFile file in folder.Files)
{
folderSize += file.Length;
}
foreach (SPFolder subfolder in folder.SubFolders)
{
folderSize += GetFolderSize(subfolder);
}
return folderSize;
}