web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / To create news article...
Power Automate
Unanswered

To create news article based on the email received using Power automate

(0) ShareShare
ReportReport
Posted on by 16

I have a requirement to build news article based on the email I received from customer. I followed this post .  It helped to some extent, but I am stuck in step 12 where I need to savepageasdraft. I get an error as "bad gateway" at this step.

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,181 Most Valuable Professional on at
    Re: To create news article based on the email received using Power automate

    Hi @kanyavenkatappa,

     

    Can you share a screenshot of how you currently have configured the Send an HTTP request action where you are saving the page as draft?

     

    Can you also post the json value you are using in your body of that action?

  • kanyavenkatappa Profile Picture
    16 on at
    Re: To create news article based on the email received using Power automate

    Thank you. Here is the snapshot of GetFileMetadata and Send HTTP.getfilemetadata.PNGsendhttp.PNG

     

    and the JSON

     

    {"__metadata":{"type":"SP.Publishing.SitePage"},"LayoutWebpartsContent":"[{\"id\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"instanceId\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"title\":\"\\n Title area\\n \",\"description\":\"\\n Title area description\\n \",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{\"imageSource\":\"/_LAYOUTS/IMAGES/SLEEKTEMPLATEIMAGETILE.JPG\"},\"links\":{},\"customMetadata\":{\"imageSource\":{}}},\"dataVersion\":\"1.4\",\"properties\":{\"imageSourceType\":2,\"title\":\"@{variables('PageName')}\",\"textAlignment\":\"Left\",\"showPublishDate\":false,\"authors\":[],\"showTopicHeader\":false,\"authorByline\":[],\"layoutType\":\"CutInShape\",\"titlePlaceholder\":\"Name your news post\",\"topicHeader\":\"\",\"hasTitleBeenCommitted\":false},\"reservedHeight\":306}]","AuthorByline":[],"TopicHeader":"","Title":"@{variables('PageName')}","BannerImageUrl":"/_layouts/15/images/sitepagethumbnail.png","CanvasContent1":"[{\"controlType\":4,\"id\":\"1212fc8d-dd6b-408a-8d5d-9f1cc787efbb\",\"position\":{\"controlIndex\":2,\"sectionIndex\":1,\"sectionFactor\":12,\"zoneIndex\":1,\"layoutIndex\":1},\"addedFromPersistedData\":true,\"emphasis\":{},\"innerHTML\":\"<p>@{outputs('Compose')}@{outputs('Html_to_text')?['body']}<br></p>\"},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true}}]","Categories":""}

  • Expiscornovus Profile Picture
    33,181 Most Valuable Professional on at
    Re: To create news article based on the email received using Power automate

    Hi @kanyavenkatappa,


    Just to double check. Do you have a Send an HTTP request to SharePoint action which will create a news post page first?

     

    createpage.png

     

    If so, I think the problem is the PageName variable in your Get file metadata action. The news posts page will get a random name which won't correspond with the PageName variable in the File Identifier field.

     

    Can you try and use this expression for the File Identifier field which will use the Url field instead?

     

     

    replace(outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['Url'], '/', '%2f')

     

     

     

    replace_field.png

     

    After that you should be able to checkout and save the page as a draft based on the itemid of the file from the Get File metadata action.

     

    itemid_savepagecheckout.png

  • kanyavenkatappa Profile Picture
    16 on at
    Re: To create news article based on the email received using Power automate

    Yes, I have Send an HTTP to create news post. I changed Get file metadata as per your suggestion. Still no luck. PFAgetfilemetadata_1.PNGsendhttp_1.PNG

  • Expiscornovus Profile Picture
    33,181 Most Valuable Professional on at
    Re: To create news article based on the email received using Power automate

    Hi @kanyavenkatappa,

     

    Do you have the checkout page http request action in your flow? In your screenshot I only see a Get file metadata followed by a savepageasdraft, just making sure you have all the actions in place.

     

    Btw, can you also share the raw input of the Send an HTTP request to SharePoint 2 action of the failed flow run?

  • kanyavenkatappa Profile Picture
    16 on at
    Re: To create news article based on the email received using Power automate

    Hi @Expiscornovus,

    Yes I do have checkoutpage "Send an HTTP request".

    checkout.PNG

     

    Let me know if this is what you are looking from "Send an HTTP request to SharEPoint 2"

    {
    "inputs": {
    "host": {
    "connectionName": "shared_sharepointonline_1",
    "operationId": "HttpRequest",
    "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
    },
    "parameters": {
    "dataset": "https://somewebsite/teams/sitename",
    "parameters/method": "POST",
    "parameters/uri": "_api/SitePages/pages(@{outputs('Get_file_metadata')?['body/ItemId']})/SavePageAsDraft",
    "parameters/headers": {
    "content-type": "application/json;odata=verbose",
    "Accept": "application/json;odata=verbose"
    },
    "parameters/body": "{\"__metadata\":{\"type\":\"SP.Publishing.SitePage\"},\"LayoutWebpartsContent\":\"[{\\\"id\\\":\\\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\\\",\\\"instanceId\\\":\\\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\\\",\\\"title\\\":\\\"\\\\n Title area\\\\n \\\",\\\"description\\\":\\\"\\\\n Title area description\\\\n \\\",\\\"audiences\\\":[],\\\"serverProcessedContent\\\":{\\\"htmlStrings\\\":{},\\\"searchablePlainTexts\\\":{},\\\"imageSources\\\":{\\\"imageSource\\\":\\\"/_LAYOUTS/IMAGES/SLEEKTEMPLATEIMAGETILE.JPG\\\"},\\\"links\\\":{},\\\"customMetadata\\\":{\\\"imageSource\\\":{}}},\\\"dataVersion\\\":\\\"1.4\\\",\\\"properties\\\":{\\\"imageSourceType\\\":2,\\\"title\\\":\\\"@{variables('PageName')}\\\",\\\"textAlignment\\\":\\\"Left\\\",\\\"showPublishDate\\\":false,\\\"authors\\\":[],\\\"showTopicHeader\\\":false,\\\"authorByline\\\":[],\\\"layoutType\\\":\\\"CutInShape\\\",\\\"titlePlaceholder\\\":\\\"Name your news post\\\",\\\"topicHeader\\\":\\\"\\\",\\\"hasTitleBeenCommitted\\\":false},\\\"reservedHeight\\\":306}]\",\"AuthorByline\":[],\"TopicHeader\":\"\",\"Title\":\"@{variables('PageName')}@{outputs('Compose')}\",\"BannerImageUrl\":\"/_layouts/15/images/sitepagethumbnail.png\",\"CanvasContent1\":\"[{\\\"controlType\\\":4,\\\"id\\\":\\\"1212fc8d-dd6b-408a-8d5d-9f1cc787efbb\\\",\\\"position\\\":{\\\"controlIndex\\\":2,\\\"sectionIndex\\\":1,\\\"sectionFactor\\\":12,\\\"zoneIndex\\\":1,\\\"layoutIndex\\\":1},\\\"addedFromPersistedData\\\":true,\\\"emphasis\\\":{},\\\"innerHTML\\\":\\\"<p><br></p>\\\"},{\\\"controlType\\\":0,\\\"pageSettingsSlice\\\":{\\\"isDefaultDescription\\\":true,\\\"isDefaultThumbnail\\\":true}}]\",\"Categories\":\"\"}"
    },
    "authentication": "@parameters('$authentication')"
    }
    }

  • Expiscornovus Profile Picture
    33,181 Most Valuable Professional on at
    Re: To create news article based on the email received using Power automate

    Hi @kanyavenkatappa,

     

    I was looking for the raw inputs to see the actual values which are used in the different dynamic content fields and variables. This way I can try and reproduce it with your test data. In your reply I still see the variables and the outputs of the compose actions as expressions. Can you post the actual values you are using?

     

    Below is the raw input I used in my test. I was able to create the page as draft with this sample. Can you check if that sample works for you as well?

     

    {
     "host": {
     "connectionReferenceName": "shared_sharepointonline",
     "operationId": "HttpRequest"
     },
     "parameters": {
     "dataset": "",
     "parameters/method": "POST",
     "parameters/uri": "_api/sitepages/pages(131)/SavePageAsDraft",
     "parameters/headers": {
     "content-type": "application/json;odata=verbose",
     "Accept": "application/json;odata-verbose"
     },
     "parameters/body": "{\"__metadata\":{\"type\":\"SP.Publishing.SitePage\"},\"LayoutWebpartsContent\":\"[{\\\"id\\\":\\\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\\\",\\\"instanceId\\\":\\\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\\\",\\\"title\\\":\\\"\\\\n Title area\\\\n \\\",\\\"description\\\":\\\"\\\\n Title area description\\\\n \\\",\\\"audiences\\\":[],\\\"serverProcessedContent\\\":{\\\"htmlStrings\\\":{},\\\"searchablePlainTexts\\\":{},\\\"imageSources\\\":{\\\"imageSource\\\":\\\"/_LAYOUTS/IMAGES/SLEEKTEMPLATEIMAGETILE.JPG\\\"},\\\"links\\\":{},\\\"customMetadata\\\":{\\\"imageSource\\\":{}}},\\\"dataVersion\\\":\\\"1.4\\\",\\\"properties\\\":{\\\"imageSourceType\\\":2,\\\"title\\\":\\\"Test\\\",\\\"textAlignment\\\":\\\"Left\\\",\\\"showPublishDate\\\":false,\\\"authors\\\":[],\\\"showTopicHeader\\\":false,\\\"authorByline\\\":[],\\\"layoutType\\\":\\\"CutInShape\\\",\\\"titlePlaceholder\\\":\\\"Name your news post\\\",\\\"topicHeader\\\":\\\"\\\",\\\"hasTitleBeenCommitted\\\":false},\\\"reservedHeight\\\":306}]\",\"AuthorByline\":[],\"TopicHeader\":\"\",\"Title\":\"Test\",\"BannerImageUrl\":\"/_layouts/15/images/sitepagethumbnail.png\",\"CanvasContent1\":\"[{\\\"controlType\\\":4,\\\"id\\\":\\\"1212fc8d-dd6b-408a-8d5d-9f1cc787efbb\\\",\\\"position\\\":{\\\"controlIndex\\\":2,\\\"sectionIndex\\\":1,\\\"sectionFactor\\\":12,\\\"zoneIndex\\\":1,\\\"layoutIndex\\\":1},\\\"addedFromPersistedData\\\":true,\\\"emphasis\\\":{},\\\"innerHTML\\\":\\\"<p>Test<b>Bold</b><br></p>\\\"},{\\\"controlType\\\":0,\\\"pageSettingsSlice\\\":{\\\"isDefaultDescription\\\":true,\\\"isDefaultThumbnail\\\":true}}]\",\"Categories\":\"\"}"
     }
    }

     flowrunhistory.png

  • kanyavenkatappa Profile Picture
    16 on at
    Re: To create news article based on the email received using Power automate

    I don't have an option of "Show raw input". Is something disabled?

    I have put savepageasdraft error and savepageasdraft

    PFA snapshotretryerror.PNGsavepageasdraf.PNG

     

  • Expiscornovus Profile Picture
    33,181 Most Valuable Professional on at
    Re: To create news article based on the email received using Power automate

    Hi @kanyavenkatappa,

     

    Can you share what the values are of the following elements in your flow?

    @{variables('PageName')} & @{outputs('Compose')}

     

    I want to use the same pagename and topicheader as you to see if I can reproduce this error.

  • kanyavenkatappa Profile Picture
    16 on at
    Re: To create news article based on the email received using Power automate

    PageName is the email subject I am using -> FW: goodone

    Outputs(Compose): is email body -->

    Hello all,
    What are you doing
    Good thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard