[英]Get total size of attached files on all list items in SharePoint 2007with PowerShell v2.0
Using Powershell I have to get the total size of all attached files on all list items for a generic list. 使用Powershell,我必须获取通用列表的所有列表项上所有附件的总大小。 I tryed to use the function below but this will display the total length of names for the attached files. 我尝试使用下面的功能,但这将显示附件的名称总长度。
function GetListSize($List, $Web)
{
[long]$listSize = 0
foreach ($listItem in $List.Items)
{
$listItemAttachments = $listItem.Attachments
foreach($file in $listItemAttachments)
{
$listSize += $file.Length
}
}
$totalInMb = ($listSize/1024)/1024
$totalInMb = "{0:N2}" -f $totalInMb
return $totalInMb
}
I can do this using c# (http://mykiavash.wordpress.com/2011/05/02/how-to-get-size-of-sharepoint-2010-list-item-attachment/) code but no ideea using PowerShell script. 我可以使用c#(http://mykiavash.wordpress.com/2011/05/02/how-to-get-size-of-sharepoint-2010-list-item-attachment/)代码来执行此操作,但不能使用PowerShell进行操作脚本。 Do you have any ideea ? 你有什么想法吗?
ok, omlin helped me to solve this. 好的,omlin帮助我解决了这个问题。 pls see : 请参阅:
https://sharepoint.stackexchange.com/questions/12652/get-total-size-of-attached-files-on-all-list-items-in-sharepoint-2007with-powersh https://sharepoint.stackexchange.com/questions/12652/get-total-size-of-attached-files-on-all-list-items-in-sharepoint-2007with-powersh
To check the size using the interface this is nice : http://msmvps.com/blogs/shane/archive/2008/06/20/list-size-reporting.aspx 要使用界面检查大小,这很好: http : //msmvps.com/blogs/shane/archive/2008/06/20/list-size-reporting.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.