SOLVED

Retrieve Full Page Body of SharePoint News Page with Power Automate

Copper Contributor

I have a SharePoint Communication site with a News webpart set up. In Power Automate, (when I try to pull in the News page body) the only field for the body of the text I am able to access is the 'Description' field (which is capped at like 250 characters). Does anyone have an idea on how I can pull the entire page body into power automate?

3 Replies
best response confirmed by Boe_Barlage (Copper Contributor)
Solution
I was able to accomplish this by using the 'Send an HTTP request to Sharepoint' function in power automate and I used the api key below.

_api/web/lists/GetByTitle(Site%20Pages')/items(ID)/CanvasContent1

Headers
accept application/json; odata=nometadata

Body
{
"value":"string"
}


Then I added the 'Parse JSON' function. In the content field, I used the body of 'Send an HTTP Request' and I pasted the same Body string above into the 'Parse JSON' 'Schema' field.

Then I passed the 'Parse JSON' value to the 'HTML to Text' power automate function.

I hope this helps someone else.

@Boe_Barlage 

 

When I followed your suggestions, this was the result of my test email. There should be colored text and highlighted text, but only bold formatting showed up. Maybe I'm doing something wrong.

In the Headers section of the Send an HTTP request to SharePoint, what should go in the key and value fields? How do I get rid of the {"d":{"CanvasContent1":" and "}}?

 

{"d":{"CanvasContent1":"

Email from this page should show up in the email.

 

Lets Hope so!

 

Cross your fingers!!!

 

here we go!

"}}

@victorylp1 

 

Hi I got this to work!

Morganna_Espinoza_0-1688762780041.png

1. First setup when a file is created or modified tile to the share point site you need and set it to site pages as a custom value

 

Morganna_Espinoza_2-1688763023760.png

 

2. Click settings on when a file is created... tile

2. Make sure to add these triggers (it will filter for news posts and only if the post is a major version 1.0 2.0 etc.,, this will stop it from sending an email when it saves 1.1 1.2 etc.,)
Trigger Condition:

@and(equals(triggerOutputs()?['body/PromotedState'],2),contains(triggerOutputs()?['body/{VersionNumber}'],'.0'))

Morganna_Espinoza_3-1688763038831.png

 

3. Click Done

Next setup the Send an HTTP request to SharePoint tile

Method: GET

URI: _api/web/lists/getbytitle('Site Pages')/items(@{triggerOutputs()?['body/ID']})/FieldValuesAsHtml?$select=CanvasContent1

Headers: accept: application/json; odata=nometadata

Body

Body
{
"value":"string"
}

 

Morganna_Espinoza_5-1688763209518.png

Then add the parse JSON Function (this will allow you to seperate each "type" and make a option for just the text you want.

paste in the following:

Morganna_Espinoza_7-1688763308013.png

 

Next add the send an email function:

add the tile "canvascontent1" which is the text you want to the body of your email!

Morganna_Espinoza_8-1688763371759.png

Voila, it should remove the metadata you were trying to remove

1 best response

Accepted Solutions
best response confirmed by Boe_Barlage (Copper Contributor)
Solution
I was able to accomplish this by using the 'Send an HTTP request to Sharepoint' function in power automate and I used the api key below.

_api/web/lists/GetByTitle(Site%20Pages')/items(ID)/CanvasContent1

Headers
accept application/json; odata=nometadata

Body
{
"value":"string"
}


Then I added the 'Parse JSON' function. In the content field, I used the body of 'Send an HTTP Request' and I pasted the same Body string above into the 'Parse JSON' 'Schema' field.

Then I passed the 'Parse JSON' value to the 'HTML to Text' power automate function.

I hope this helps someone else.

View solution in original post