Possible to parse through outlook emails?

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Chris Wolfenden Chris Wolfenden 6 months ago.

  • Author
    Posts
  • #40971
    Profile photo of ertuu85
    ertuu85
    Participant

    We have a SEP server that sends out emails to a shared IT email box, this sends out alerts for say 'attacked computers'.

    I would like to write a script that would read the email sent from the alert and determine it's severity based on the server's that are affected.

    Is there a way to accomplish this with powershell?

    I found this from Ed Wilson: https://blogs.technet.microsoft.com/heyscriptingguy/2011/05/26/use-powershell-to-data-mine-your-outlook-inbox/

    But it seems to just list the inbox.

    I do have access to the exchange management shell as well.

    Any tips would be appreciated

  • #40975
    Profile photo of Dan Potter
    Dan Potter
    Participant

    It is but it's easier to use the exchang ews api.

  • #40981
    Profile photo of Chris Wolfenden
    Chris Wolfenden
    Participant

    You may want to take a look at EWS (Exchange Web Services). I recently dove into it to replace an old scripted outlook mail rule. I ended up using a variety of sites including good ole MSDN so I dont' have any specific sites to recommend but I would a quick search on 'Powershell EWS'. Here's one link I browsed that gives a short example:

    http://www.drowningintechnicaldebt.com/GregTate/archive/2015/03/18/using-exchange-web-services-managed-api-in-powershell.aspx

    Thanks,
    Chris

  • #40988
    Profile photo of ertuu85
    ertuu85
    Participant

    Say I have a subfolder called test under Inbox, using the API, how would I specify a subfolder of inbox?

     $inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($ews,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox) 
    
  • #40996
    Profile photo of Chris Wolfenden
    Chris Wolfenden
    Participant

    I'll be honest, I found EWS to have a bit of a learning curve. There may be an easier way (still trying to figure out EWS myself), but you could try:

    $inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($ews,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox) 
    $folderID = $inbox.FindFolders(10) | Where-Object { $_.DisplayName -eq "Test"} | Select -ExpandProperty ID
    $test =  [Microsoft.Exchange.WebServices.Data.Folder]::Bind($ews,$folderID)
    

    Thanks,
    Chris

You must be logged in to reply to this topic.