Power Automate

How To Change An Email Subject In Power Automate

How To Change An Email Subject In Power Automate Posted by - Matthew Devaney on - January 28, 2024 14 Comments Power Automate can be used to change an email ...

Matthew Devaney
Published
Reading time
3 min read

Before you start

Is this guide for you?

Best entry point
Power Automate
Time investment
3 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/how-to-change-an-email-subject-in-power-automate/. Author: Matthew Devaney.

How To Change An Email Subject In Power Automate Posted by - Matthew Devaney on - January 28, 2024 14 Comments

Power Automate can be used to change an email subject line. There is no dedicated flow action to do this. However, we can call the Microsoft Graph API with the Outlook Send An HTTP Request action and use it to change the email’s subject if we know the right endpoint. Best of all, it doesn’t require any premium licensing. Table of Contents

Introduction: The IT Helpdesk Case Id Automation

Configure The “When A New Email Arrives” Trigger Settings

Change The Email Subject Using The Microsoft Graph API

Run The Flow To Update An Email Subject In Power Automate

Introduction: The IT Helpdesk Case Id Automation

The IT helpdesk at a financial services company tracks each case by assigning it a unique case id. When a new request for help email is received in their inbox the helpdesk uses Power Automate to change the subject line to include a Case Id.

For example, [Case Id #1] appears at the end of this email’s subject line.

Configure The “When A New Email Arrives” Trigger Settings

Open Power Automate and create a new automated flow using the Office 365 Outlook – When A New Email Arrives (V3 ) trigger. Choose the Folder named Inbox.

Go to the trigger’s Settings and enable Split On . This tells Power Automate to evaluate each email individually as it arrives in the inbox.

We also want to determine whether the flow needs to add a Case Id or if it already has one.

Use this expression in the Trigger Conditions to only change the subject line of emails with no Case Id.

@not(contains(triggerBody()?[ 'body/subject' ], '[Case Id#' )) Code language: JavaScript ( javascript )

Change The Email Subject Using The Microsoft Graph API

The new email subject line should include the original subject and then append a tracking number to the end. Add a Data Operations – Compose action to the flow with the following values in the Inputs field. In this tutorial we will use a hardcoded value since the focus is on how to update the Subject Line.

There is not any Power Automate action to change a subject line so we must use the Microsoft Graph API instead. Insert the Office 365 Outlook – Send An HTTP Request action into the flow and select the PATCH method .

Use the following URI to update the message object.

https: //graph.microsoft.com/v1.0/me/messages/@{triggerOutputs()?['body/id']} Code language: JavaScript ( javascript )

Supply this JSON to the Body of the action. {

"subject" : "@{outputs('Compose:_New_Subject_Line')}" } Code language: JSON / JSON with Comments ( json )

Write this code in the Content-Type field. application/json

Run The Flow To Update An Email Subject In Power Automate

That’s all we need to change the email subject line of an incoming message. Press the Test button in the Power Automate editor and then send an email to the target inbox. The flow will complete successfully.

And the email subject line will be updated to include [Case Id# 1] at the end. Did You Enjoy This Article? 😺

Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?

If you have any questions or feedback about How To Change An Email Subject In Power Automate please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney Power Automate

Save Docusign Document To SharePoint With Power Automate

Share this

Tagged

Power Automate

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nxtM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →