Finding out where SharePoint email alias is used

Recently, a question came up in the SharePoint TechNet forums regarding document libraries with incoming email enabled.  If you only know the name of the AD contact for the library, how can you find out which document library or list it’s pointing to? 

Here’s a straightforward PowerShell script which will iterate through every site collection in every web application and return the names and email aliases of every list that has an active email alias specified.


[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | out-null

[void][System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$oContentService = [Microsoft.Sharepoint.Administration.SPWebService]::ContentService;

[Microsoft.SharePoint.Administration.SPWebApplicationCollection]$waColl = $oContentService.webApplications;

$waColl1 = $waColl | where-object {$_.IsAdministrationWebApplication -eq $FALSE}
write-host "WebApplication; Site Collection; List Title; List URL; EmailAlias"

foreach ($wa in $waColl1)
{

$sites = $wa.Sites

foreach ($obj in $sites)

{

$spSite = new-object Microsoft.SharePoint.SPSite($obj.URL)

$colWebsites = $spSite.AllWebs

foreach ($web in $colWebsites)
{

 $colLists = $web.Lists
 
 foreach ($list in $colLists)
 {

 if ( $list.EmailAlias -ne $null )
 {

 write-host  $wa.Name, ";", $obj.URL, ";", $list.Title , ";", $list.DefaultViewUrl, ";",  $list.EmailAlias

 }

 }

}

}

}

write-host "Finished."
Advertisements

0 Responses to “Finding out where SharePoint email alias is used”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




RSS Information Week Headlines

  • An error has occurred; the feed is probably down. Try again later.

RSS SharePoint Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoPath Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Joel Oleson Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Susan Hanley’s KM Blog

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 350,836 hits

%d bloggers like this: