cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
myatix
Helper I
Helper I

Add PreFix to Outlook Message Subject via Graph API???

Hi All,

I am trying to add a prefix to an email and then move it to a new folder in the same mailbox. I do not want to forward to email as it is in the correct mailbox.

 

I can understand if I use MS Graph I can manipulate the message using the HTTP action to call the graph message api

 

https://graph.microsoft.com/v1.0/users/[UserID]/messages/[Message id]

 

I am not a developer and could use a little assistance in getting this to work. 

 

If I initiate a variable and concat the subejct of the orginal email then update this via graph I am hoping this will work.

 

 

concat('PreFix',triggerOutputs()?['body/subject']) 

 

 

Is my Expression correct?

 

 

{
   "subject":[
      "@{variables('MessageSubject')}"
   ]
}

 

 

myatix_0-1659602293882.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
VictorIvanidze
Community Champion
Community Champion

This works for me:

VictorIvanidze_0-1660892402612.png

Try to do the same. 

 

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

View solution in original post

9 REPLIES 9
myatix
Helper I
Helper I

The question is can this be done?

I am not even sure you can minipulate the subject line of an email in Graph?

https://docs.microsoft.com/en-us/graph/api/message-update?view=graph-rest-1.0&tabs=http

 

The subject of the message. Updatable only if isDraft = true.

 

Has anyone found a solution to changing the subject of incoming emails. The business case for this is we need to add a PreFix to incoming emails so they can be handled in our ticketing system.

VictorIvanidze
Community Champion
Community Champion

Hi @myatix,

you can add a prefix using an Exchange online transport rule. 

Are you sure you have to do that using Power Automate?

 

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.
myatix
Helper I
Helper I

@VictorIvanidze  Thanks for the response! Yes we could use a transport rule but we are currently using Power Automate to move Invoices from a shared mailbox junk folder to the correct folder in the same mailbox so it would have been nice to have it all included in the same Power Automate flow.

 

But I can see this isn't possible... 

VictorIvanidze
Community Champion
Community Champion

MS documentation is wrong.

I've just done a quick test and in fact you can change the Subject of ingoing message.

Request body I've used is

{
    "subject": "blabla"
}

 

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

@VictorIvanidze 
Thanks for the response ... But

myatix_0-1660824010287.png

I get a 405 error stating:

{
  "error": {
    "code""ErrorInvalidRequest",
    "message""The OData request is not supported."
  }
}
 
How did you get yours to work?
VictorIvanidze
Community Champion
Community Champion

What action you are using to execute a request?

Try to use "Send an HTTP request" from "Office 365 Groups" connector.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.
myatix
Helper I
Helper I

@VictorIvanidze  I was using the standard HTTP action as shown in my first post.

I get the same issue with the Office 365 Group connector?

myatix_0-1660891255657.png

 

As well as the same error in the "Outlook - Send an HTTP Request" connector. 

 

VictorIvanidze
Community Champion
Community Champion

This works for me:

VictorIvanidze_0-1660892402612.png

Try to do the same. 

 

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.
myatix
Helper I
Helper I

@VictorIvanidze Thanks for the help! The reason it wasn't working was that my Graph API call was miss formed. I read another community post which helped me solved the issue for a shared mailbox. 

https://powerusers.microsoft.com/t5/Using-Connectors/Item-Id-doesn-t-belong-to-the-current-mailbox/m...

 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (1,518)