I was looking for a way with powershell to find all the lists in my sharepoint 2007 farm that had email enabled document libraries as well as the email address associated with them. Didn’t take long to find a script for this on technet http://social.technet.microsoft.com/Forums/da-DK/sharepointgeneral/thread/457387e3-05af-425c-9de4-5aa15d673a19 , but that version used the Get-SPWebApplication cmdlet which does not work with SP2007. So I replaced it with the sp2007 equivilent
[System.reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
[System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
$SPwebapp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup(“http://myspfarm”)
#create a CSV file
“E-Mail,List,Site” > “EMail-Enabled.txt” #Write the Headers in to a text file
foreach ($SPsite in $SPwebApp.Sites) # get the collection of site collections
{
foreach($SPweb in $SPsite.AllWebs) # get the collection of sub sites
{
foreach ($SPList list in $SPweb.Lists)
{
if ( ($splist.CanReceiveEmail) -and ($SPlist.EmailAlias) )
{
# WRITE-HOST “E-Mail -” $SPList.EmailAlias “is configured for the list “$SPlist.Title “in “$SPweb.Url
$SPList.EmailAlias + “,” + $SPlist.Title +”,” + $SPweb.Url >> EMail-Enabled.txt #append the data
}
}
}
}
thanks http://jshidell.com/ for that pointer
(265)