Search code examples
sharepointpower-automatesharepoint-webservice

SharePoint HTTP connector - Unable to change sender name of no-reply emails


I was referring to the following guide on how to send a SharePoint no-reply email with a specific sender name, which was triggered via Power Automate:

https://michelcarlo.com/2020/04/04/sharepoint-http-connector-send-a-no-reply-email-specific-sender-name-in-a-flow/

I've tried both display name and email address (via the O365 connector) and assigned these values to the From property, but this did not work in either scenario. Unless something has changed in the connector since this guide was published, I'm stumped.

{
  'properties':{
  'From':'',
  'To':['@{variables('Email')}'],
  'CC':[''],
  'Subject':'@{variables('RequestID')} requires changes',
  'Body':'Dear @{variables('Name')},<br><br>Please update this item according the the following comment:<br><br>@{variables('Comments')}<br><br>Thank you.<br><br>Best regards,<br>X'
  }
}

Update #1:
For some reason this worked ONCE yesterday while testing but not on subsequent attempts. The SharePoint site name appeared as the sender! Strangest part is I left the From field blank. I wonder if my organization admin made changes of if Microsoft has finally fixed this...

Update #2:
Failing which, is there a way to ensure the SharePoint site name appears as the sender every time? Right now the flow does that, but on every alternate request it goes back to 'Online, Sharepoint (Gen)'


Solution

  • I am not sure if at the time of tutorial writing nested properties were fetched in that way but they are fetched in totally different way now.
    I presume the mistake you did was to copy the code of POST body from tutorial. Had you written it yourself by placing the properties from Dynamic Content popover, you wouldn't have faced this issue.

    Check below how each property is fetched in Power Automate. You can use 2 approaches to fix your code though i would recommend the 2nd approach.

    • Either you can place individual property to your code
    • You keep the POST body schema intact, remove the variable mapping and map them again dynamically.

    Also you can fetch the To property from GetItem itself instead of triggerOutputs

    @{outputs('Get_item')?['body/From/Email']};   
    @{outputs('Get_item')?['body/To/Email']};  
    @{outputs('Get_item')?['body/Title']};  
    @{outputs('Get_item')?['body/Body']}