- This topic has 1 reply, 2 voices, and was last updated 4 months, 3 weeks ago by
February 12, 2020 at 4:31 am #203102ParticipantTopics: 1Replies: 0Points: 7Rank: Member
I require some assistance in retrieving the subject of the most recent email from a particular sender.
The breakdown: Upon creation of a project within a online software app, an email from the app is automatically sent to my inbox. Using Power Automate, I have created a flow that when an email arrives from the particular sender with a particular subject content (using the conditional trigger), an azure automation script is run. I am using powershell (within the azure automation interface) to write a script that creates a MS team:
Param( [string]$teamname, #The name of the Team [string]$teamowner, #The email address of the owner of the Team [string]$teamalias #The bit of the teamname you want to be the URL ) #Connect to Teams PowerShell $cred = Get-AutomationPSCredential -Name "TeamsAdmin" $teams = Connect-MicrosoftTeams -Credential $cred #Create the Team $newteam = New-Team -Alias $teamalias -DisplayName $teamname -Owner $teamowner -AccessType Private #Return to Flow the new teams GroupID by passing the object as JSON write-output $newteam | convertto-json #Hangup Disconnect-MicrosoftTeams
Instead of inserting parameters such as the name of the team, I am wanting the script to data mine through outlook, find the most recent email from the particular sender AND of a particular subject, then retrieve part of the subject name to use as the team name. The email subject is of the format: “Blah Blah part of subject I want as team name Blah Blah”, unsure whether it would be easier to retrieve the entire subject name then remove the Blah parts later.
Thanks for any and all assistance!
February 12, 2020 at 7:37 pm #203237ParticipantTopics: 12Replies: 1642Points: 2,660Rank: Community Hero
Have you looked at EWS?
Not really a fan of Office COM if it can be avoided. The script could be run from anywhere (with EWS installed) versus running on a workstation with Office and Outlook configured.
- The topic ‘Retrieve Most Recent Email Subject From Particular Sender’ is closed to new replies.