For completeness, here is a dump of the "rough and ready" code that I used to 
get my listing of approximate sizes for each list in a WSS 2.0 site collection:

 





 

public class SPContentEnumerator {

private long _allSitesSize = 0;

private string _url;

private StringBuilder _sb;

public SPContentEnumerator(string url) {

this._url = url;

_sb = new StringBuilder();

}



public void Run() {

Console.WriteLine("Running...");

using (SPGlobalAdmin globalAdmin = new SPGlobalAdmin()) {

SPVirtualServer virtualServer = globalAdmin.OpenVirtualServer(new 
Uri(this._url));

foreach (SPSite site in virtualServer.Sites) {

if (site.Url.EndsWith("NAME OF WHICH EVER SITE COLL YOU WANT TO LIMIT TO")) {

using (SPWeb web = site.OpenWeb()) {

PrintWebInfo(web);

}

}

site.Dispose();

}

}

_sb.AppendLine();

_sb.AppendLine(

string.Format(

"Total size for all sites {0}.", 

Formatter.PrintFilesize(_allSitesSize)));

File.WriteAllText("C:\\SP.txt", _sb.ToString());

}



private void PrintWebInfo(SPWeb web) {

_sb.AppendLine();

_sb.AppendLine(string.Format("Site {0} ({1})", web.Title, web.Url));

_allSitesSize += PrintListInfo(web);

if (web.Webs.Count > 0) {

foreach (SPWeb subweb in web.Webs) {

PrintWebInfo(subweb);

subweb.Dispose();

}

}

}



private long PrintListInfo(SPWeb web) {

long siteSize = 0;

foreach (SPList list in web.Lists) {

long sizeOfList = 0;

foreach (SPListItem item in list.Items) {

if (item.File != null) {

sizeOfList += item.File.Length;

}

}

siteSize += sizeOfList;

_sb.AppendLine(string.Format(

" {0} - Items: {1}, Total Size: {2}.", 

list.Title, 

list.ItemCount, 

Formatter.PrintFilesize(sizeOfList)));

}

_sb.AppendLine(string.Format(

"Total size for site {0}.", 

Formatter.PrintFilesize(siteSize)));

return siteSize;

}

}

 





 



Kind Regards,
 
Darren Neimke
[email protected] 



 


Date: Wed, 10 Jun 2009 20:41:05 -0700
From: [email protected]
Subject: RE: WSS 2.0 Content Reporting
To: [email protected]



Thx JT, the solution ended up being a whole lot uglier and hackier in (an 
unpatched version of ) WSS 2.0... but this was enough to get me moving on it.  
Cheers!


Kind Regards,
 
Darren Neimke
[email protected] 



 


Date: Wed, 10 Jun 2009 11:09:26 +1000
From: [email protected]
Subject: RE: WSS 2.0 Content Reporting
To: [email protected]







I’ve done something like that in PowerShell with the object model in v3.0 and 
I’m assuming this could be done the same way for v2.0. The script below is just 
recursively spinning through and outputting the SPWeb Title...but could be 
extended to then spin through every list and aggregate the file attachments 
sizes and report on them.
 
$webappUrl = "http://sitecollectionurl/";;
 
Clear-Host
$12HivesDir = "${env:CommonProgramFiles}\Microsoft Shared\web server 
extensions\12\"
[System.Reflection.Assembly]::LoadFrom("$12HivesDir\ISAPI\Microsoft.SharePoint.dll")
 
function get-spweb ([String]$webUrl=$(throw 'Parameter -webUrl is missing!'))
{
   $site =  New-Object -TypeName "Microsoft.SharePoint.SPSite" -ArgumentList 
"$webUrl";
   return $site.OpenWeb();
}
function get-spwebInfo ($web)
{
   Write-Host $web.Title
   Write-Host $web.Url
   if ($web.Webs.Count -ne 0)
   {
      Write-Host "======================================="
      Write-Host "Sub webs of " $web.Title
      Write-Host "======================================="
      foreach ($subweb in $web.Webs)
      {
            get-spwebInfo($subweb);
            $subweb.Dispose();
      }
      Write-Host "======================================="
   }
}
 
$devWeb = get-spweb $webappUrl
get-spwebInfo($devWeb);
$devWeb.Dispose();
 
 
 


From: [email protected] [mailto:[email protected]] On Behalf Of Darren Neimke
Sent: Wednesday, 10 June 2009 8:28 AM
To: [email protected]
Subject: WSS 2.0 Content Reporting
 
Hi all, does anybody on this list have (or know of) a favorite tool for 
producing a report about the number of documents and the total allocated 
content storage size for a given SharePoint (WSS 2.0) site?
 
Ideally, I'd like to point it at a number of sites (or at an individual site 
collection) and see, at a glance, information such as:
 
 
Site Name    Library Name         Items    Total Size
-------------------------------------------------------
Site A          LibA                      42          32MB
Site A          LibB                      16          10MB
Site B          LibA                      38          8MB
Site B          LibB                      13          16MB

 
 

Kind Regards,
 
Darren Neimke
[email protected] 







Windows Live™ SkyDrive™: Get 25 GB of free online storage. Get it on your 
BlackBerry or iPhone.




Support procedure: https://www.codify.com/lists/support
List address: [email protected]

Subscribe: [email protected]

Unsubscribe: [email protected]

List FAQ: http://www.codify.com/lists/ozmoss

Other lists you might want to join: http://www.codify.com/lists


Support procedure: https://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozmoss
Other lists you might want to join: http://www.codify.com/lists


Windows Live™: Keep your life in sync. Check it out. 


Support procedure: https://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozmoss
Other lists you might want to join: http://www.codify.com/lists
_________________________________________________________________
Lauren found her dream laptop. Find the PC that’s right for you.
http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290--------------------------------------------------------------------------------
Support procedure: http://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozmoss
Other lists you might want to join: http://www.codify.com/lists

Reply via email to