Wednesday, 6 February 2019

Get Incomming e-mail settings in a library



Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Web Application URL 
#$WebAppURL="http://webapp1/"
$Report="D:\temp\IncomingEmails.csv"

 $AllWebs =
'https://webapp2',
#'https://webapp3/',
#'https://webapp4/',


#foreach($WebAppURL in $AllWebs)
#{


# Enumerate all lists in the web application
$AllWebs|  Get-SPWebApplication  | Get-SPSite -limit ALL | Get-SPWeb -Limit ALL | ForEach-Object {
#Get the Current Site
$Site = $_
#Get all Lists with Incoming Email enabled
 $Site.Lists | Where-Object { ($_.CanReceiveEmail) -and ($_.EmailAlias) }| ForEach-Object {
      New-Object -TypeName PSObject -Property @{
              ListName = $_.Title
              SiteUrl = $Site.Url
              Email = $_.EmailAlias
               lastModified=$_.LastItemModifiedDate
               itemCount = $_.ItemCount  }
   }
} | Export-CSV $Report -NoTypeInformation

#}
Write-host "Incoming Emails Report Generated!"

No comments:

Post a Comment