Forum Discussion
Retrieve Full Page Body of SharePoint News Page with Power Automate
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?
- 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_BarlageCopper ContributorI 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.- victorylp1Copper Contributor
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!
"}}
- Morganna_EspinozaCopper Contributor
Hi I got this to work!
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
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'))
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"
}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:
Next add the send an email function:
add the tile "canvascontent1" which is the text you want to the body of your email!
Voila, it should remove the metadata you were trying to remove