function GetListSize($List)
{
[long]$listSize = 0
$allAttachmentsFolder = $List.RootFolder.SubFolders["Attachments"]
foreach ($listItem in $List.Items)
{
$listItemAttachments = $listItem.Attachments
$attachmentsFolder = $allAttachmentsFolder.SubFolders[$listItem.ID]
foreach($file in $listItemAttachments)
{
$listSize += $attachmentsFolder.Files[$file].Length
}
}
$totalInMb = ($listSize/1024)/1024
$totalInMb = "{0:N2}" -f $totalInMb
return $totalInMb
}
Ref: http://sharepoint.stackexchange.com/questions/12652/get-total-size-of-attached-files-on-all-list-items-in-sharepoint-2007with-powers
No comments:
Post a Comment