I have slightly customized the code shared by Mr. MahmutKarali and it worked for me. As you are looking to get access token without user interaction, in that case, client credential flow is recommended to get the access token which is commonly used for background process where impersonating a user is not . This will utilize the email template and groups that we prepared earlier. PowerShell uses .NET to control Outlook programmatically, file away the reports, and create customized emails for each recipient. If you do not know the name of your account/Folder, you can get the names of your accounts/Folders using the following code. Find the properties you want to read from the e-mail object. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Hi, How can i add content in the email body(not in email subject), help me with the script part and write it for me. It may take three or four such loops to handle all the items that need handling. Also please report any factual mistakes, grammatical errors or broken links, I will be happy to correct the fault. This part of the code is shown in Figure 2. So by using indexOf() to find the place in the source string where "Email: " exists, then adding that number of characters to it, we get the point we want to start reading the email address. It could be a text string, or it could even be the output from another PowerShell command. In this article, we will use three examples to demonstrate how you can process emails with Power Automate. Comments are closed. Now lets build on that example by adding more content to the message body of the emails. The function I wrote is called CopyMove-Email. $inbox | Where-Object { $_.subject -match 2012}. The differencewith mine is the data I'm looking for doesn't match a nice pattern that can be easily defined by say.. add(indexof ), 10. My case is a little different and I want to extract theemail address after theFrom:of a forwarded email. Don't forget to add Dim regPattern As String at the top of the module. Add a "Compose" action, Inputs set to following formula: Add a "Compose 3" action, Inputs set to following formula. This allows me to work with the Inbox content in an easy fashion without needing to query the Inbox over and over again. I was talking to my boss the other day, and he made a rather interesting observation. Nevertheless, I am beginning to suspect that is not the case. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server.