1

I have a list that is enabled to receive emails. On the list settings in the web interface I can see the entire email address (for example [email protected]), but I'd like to get this email address using PowerShell and the server object model.

So far I have only figured out how the get the email alias:

$web = Get-SPWeb https://example.net/sites/Test
$list = $web.Lists['My List']
$list.EmailAlias # Returns only 'MyList'

This is only the part before the @ symbol - how do I get the rest? I'm asking for SharePoint 2013, although I imagine it is the same for 2010 and 2016.

1 Answer 1

1
$web = Get-SPWeb https://example.net/sites/Test
$list = $web.Lists['My List']
$list.EmailAlias # Returns only 'MyList'
$service = Get-SPService | ?{$_.TypeName -match 'incoming'}
Write-Host "$($list.EmailAlias)@$($service.ServerDisplayAddress)"

The fully qualified address is not stored on the List object so we must get it from the Incoming Email service itself.

2
  • Thanks! Get-SPService doesn't appear to be available on 2013 though. (Get-SPServiceInstance |? { $_.TypeName -match 'incoming' }).Service.ServerDisplayAddress seems do to the trick! Commented Dec 21, 2017 at 16:05
  • True, my bad. Glad you got it worked around.
    – user6024
    Commented Dec 21, 2017 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.