cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JRuss
Helper II
Helper II

Send an HTTP Request to SharePoint: Body formatting

I'm trying to recreate a Designer 2010 workflow in Power Automate, since they are being deprecated.  I need to send an email to multiple SP groups upon file upload to a specific directory in a library.  I don't want to do all of that Initialize Variables and Parsing JSON nonsense.  It should - IT NEEDS - to be easier than that, imho.  So, I have all of that figured out by using the Send an HTTP Request to SharePoint step in Power Automate.  But I am not familiar with the JSON syntax needed to format the body as HTML or Rich Text style markup.  Is there a reference for this?  Bold, bold red, hyperlinks, etc.  Thanks in advance-

4 REPLIES 4
PrasadAthalye
Super User
Super User

JSON Syntax can be plain text. Which API are you calling? If you are querying the site group you can find details in the below thread...

https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/SharePoint-Group-Operations-in-Mic...

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

The Uri is /_api/SP.Utilities.Utility.SendEmail

 

The link you included doesn't appear to have syntax reference, only Initialize Variables and Parse JSON things.  When you say 'plain text', are you saying that I cannot format the text in the Body of an email composed in the Send an HTTP Request to SharePoint action step?  I see paragraph tags <p> </p> in the sample I followed online.  I'd like to markup using HTML, but I keep getting an error like this one:

 

Not well formatted JSON stream.
clientRequestId: cd2a187f-f558-4ac2-883e-cefbfa4eab79
serviceRequestId: b20caf9f-a00f-b000-a6fe-ba70c8dece45

Ok, Understood. Can you please refer below? You can put your body HTML in the body tag within single quotes...

 

{
'properties': {
'To': ['p@p.com','y@y.com'],
'Body': '<b>Yo</b><br/>O boy!',
'Subject': 'E-mail using Flow via SharePoint'
}
}

 

PrasadAthalye_1-1614351309925.png

 

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

I did that and it throws the error.  Maybe my HTML is of the wrong version?  Here's my code:

 

{
'properties': {
'__metadata': {
'type': 'SP.Utilities.EmailProperties'
},

'To': {
'results': ['SP_Group_DEV', 'SP Group_DEV2']
},
'Body': '

<p><span
style='font-size:10.0pt;line-height:115%;font-family:"Arial",sans-serif;
color:black'>The most recent list of special requests in which your
distributors have made Out-of-APR sales considered In-APR is now available on
the NA Channel Management SharePoint site.&nbsp; The Territory Sales Manager
needs to validate the request and edit the appropriate columns in the file.</span></p>

<p><b><span
style='font-size:10.0pt;line-height:115%;font-family:"Arial",sans-serif;
color:black'>For every request that affects your distributor you need to either
&quot;Approve&quot; or &quot;Reject&quot; each transaction in Column A of the
spreadsheet.&nbsp; Remember to add your name to Column B and the date in Column
C as well.</span></b></p>

<p><b><span
style='font-size:10.0pt;line-height:115%;font-family:"Arial",sans-serif;
color:red'>Please validate these in a timely manner, if you don't the
transaction will not be processed in SAP and could have an unintended result on
your distributor's CPM report.&nbsp; </span></b><span style='font-size:10.0pt;
line-height:115%;font-family:"Arial",sans-serif;color:black'>Once validated the
Territory Sales Manager should click "Save" in the top left.&nbsp; </span></p>

<p><span
style='font-size:10.0pt;line-height:115%;font-family:"Arial",sans-serif;
color:black'>If this list does not include any distributor requests for the
distributors you are responsible for, please disregard.</span></p>

<p><span
style='font-size:10.0pt;font-family:"Arial",sans-serif;color:black'>Please&nbsp;</span><a
href="https://link.com">

<span
style='font-size:10.0pt;font-family:"Arial",sans-serif;color:blue'>click here</span></a><span
style='font-size:10.0pt;font-family:"Arial",sans-serif;color:black'>&nbsp;to
see the list of requests.</span></p>

<p><span
style='font-size:10.0pt;line-height:115%;font-family:"Arial",sans-serif'>Thank
you,</span></p>

<p><span
style='font-size:10.0pt;font-family:"Arial",sans-serif'>Name</span></p>

<p>>&nbsp;</p>

</div>',

'Subject': 'Test email from MS Flow'
} }

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Users online (32,415)