none
Using Powershell with EWS - cannot see sender email address RRS feed

  • Question

  • I'm using Powershell with EWS to connect sort through a massive emailbox. It seems that the email properties show only the From header, not the actual sender header for an email. (The nice name, vs the actual email)

    $emailProps = New-Object Microsoft.Exchange.WebServices.Data.PropertySet ([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
    $emailProps.RequestedBodyType = "Text"
    .
    .
    .
    $inboxItems = $service.FindItems($inboxFolder.Id,$searchFilter,$itemView)
    
    $inboxItems | %{
    
    $email = [Microsoft.Exchange.WebServices.Data.EmailMessage]::Bind($service, $_.Id, $emailProps)

    But how do I add actual email sender address to the $email variable. I've (obviously?) trimmed out a lot of unneeded code.
    Tuesday, January 31, 2017 4:50 PM

All replies

  • You might need to clarify your question and show examples of what you mean eg (The nice name, vs the actual email) really doesn't mean anything and your code sample doesn't show what your trying to do with those particular properties.

    There are both From and Sender properties on an Email which are of type EmailAddress which has properties for Name and Address, these properties don't get returned with the FindItem operation on the DisplayName of the sender is returned.

    Wednesday, February 1, 2017 1:43 AM