Hi everyone, I'm struggling with a workflow that is attempting to copy list data to a site page based on this YouTube video:
https://youtu.be/QtBqeEEOgdE
Apologies for the length of this one. I figured better to be thorough. The 502 error is in the final step. The page does get created but without the list information.
Here is the 502 error:
{
"error": {
"code": 502,
"source": "flow-apim-msmanaged-na-northcentralus-01.azure-apim.net",
"clientRequestId": "2ef6cea8-ea4d-41d6-9898-000b7b0c4c86",
"message": "BadGateway",
"innerError": {
"status": 502,
"message": "There was an error deserializing the object of type Microsoft.SharePoint.Publishing.SitePageFieldsData. Encountered unexpected character 'S'.\r\nclientRequestId: 2ef6cea8-ea4d-41d6-9898-000b7b0c4c86\r\nserviceRequestId: 7cdb10a1-c082-4000-fe15-bbf9e34dda92",
"errors": [
"-1",
"System.Runtime.Serialization.SerializationException"
]
}
}
}
Here is the JSON payload:
{__metadata: {type: "SP.Publishing.SitePage"},…}
AuthorByline
:
["i:0#.f|membership|myemail@work.ca"]
BannerImageUrl
:
"/_layouts/15/images/sitepagethumbnail.png"
CanvasContent1
:
"[{\"controlType\":4,\"id\":\"64a5d11d-9c56-46fe-a344-25520738dfbd\",\"position\":{\"layoutIndex\":1,\"zoneIndex\":1,\"sectionIndex\":1,\"sectionFactor\":12,\"controlIndex\":1},\"addedFromPersistedData\":true,\"innerHTML\":\"<p>Employee name: {Nominee}</p><p>Department: {Nominee Unit}</p><p>Description: {One to three lines…}</p>\"},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true,\"isSpellCheckEnabled\":true,\"globalRichTextStylingVersion\":1,\"rtePageSettings\":{\"contentVersion\":5},\"isEmailReady\":false}}]"
LayoutWebpartsContent
:
"[{\"id\":\"1ee8960a-2fa0-4145-b9bb-e818f6cf18e7\",\"instanceId\":\"1ee8960a-2fa0-4145-b9bb-e818f6cf18e7\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{\"baseUrl\":\"https://dalu.sharepoint.com/sites/medit-development\"},\"componentDependencies\":{\"layoutComponentId\":\"8ac0c53c-e8d0-4e3e-87d0-7449eb0d4027\"}},\"dataVersion\":\"1.0\",\"properties\":{\"hideWebPartWhenEmpty\":true,\"isEditMode\":true,\"isEnabled\":false,\"layoutId\":\"FilmStrip\",\"uniqueId\":\"06d47312-1d46-4845-b416-2da516f056c9\",\"dataProviderId\":\"RecommendedItems\",\"webId\":\"f178f91e-6af0-49fe-aace-54bd48f44d7b\",\"siteId\":\"d4e8407f-c386-4f50-b936-1c6766c25266\"},\"containsDynamicDataSource\":false,\"reservedHeight\":356},{\"id\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"instanceId\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"title\":\"Title area\",\"description\":\"Title Region Description\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{}},\"dataVersion\":\"1.4\",\"properties\":{\"title\":\"getpayload\",\"imageSourceType\":4,\"layoutType\":\"FullWidthImage\",\"textAlignment\":\"Left\",\"showTopicHeader\":false,\"showPublishDate\":false,\"topicHeader\":\"\",\"enableGradientEffect\":true,\"isDecorative\":true,\"authors\":[{\"id\":\"i:0#.f|membership|medcomm@dal.ca\",\"upn\":\"myemail@work.ca\",\"email\":\"myemail@work.Ca\",\"name\":\"Medical My work Email\",\"role\":\"Me at work\"}],\"authorByline\":[\"i:0#.f|membership|myemail@work.ca\"],\"hasTitleBeenCommitted\":true},\"containsDynamicDataSource\":false,\"reservedHeight\":280}]"
Title
:
"getpayload"
TopicHeader
:
""
__metadata
:
{type: "SP.Publishing.SitePage"}
Here is the flow:



encodeUriComponent(concat('/SitePages/',replace(triggerOutputs()?['body/Title'], ' ', ' '),'.aspx'))
Note: the original syntax from the blog gave a file not found error so I removed ‘-’. encodeUriComponent(concat('/SitePages/',replace(triggerOutputs()?['body/Title'], ' ', '-'),'.aspx')) as a result of this post: https://powerusers.microsoft.com/t5/Building-Flows/Get-file-metadata-failed-Route-did-not-match/td-p/1806612

This step uses the ItemId from the get metadata step.

This step also uses the ItemId from the get metadata step.
Here are the steps from the video: (seen at 1:14 for the first 6 steps)
- Create a news page template
- Create a sample page and publish it.
- Publish page, copy Payload in a NotePad file.
- Create a flow.
- Add a Send HTTP action:
- Add the Title field from the list for the new page name.

- These steps are shown at (11:18 of the video) Get file identifier with this very specific syntax - SitePage%2f/@{triggerBody()?[‘Title’]}.aspx
- The expression syntax of this syntax encodeUriComponent(concat('/SitePages/',replace(triggerOutputs()?['body/Title'], ' ', '-'),'.aspx')) needed to be changed to prevent a file not found error. I removed the dash and then it worked.

- Next check the page out.

- The final step takes the payload referenced above, which is a JSON file. (I’m not going to copy the entire JSON for clarity purposes.) The ItemID is also from the get file metadata step above.
The JSON is:
{__metadata: {type: "SP.Publishing.SitePage"},…}
AuthorByline
:
["i:0#.f|membership|medcomm@dal.ca"]
BannerImageUrl
:
"/_layouts/15/images/sitepagethumbnail.png"
CanvasContent1
:
"[{\"controlType\":4,\"id\":\"64a5d11d-9c56-46fe-a344-25520738dfbd\",\"position\":{\"layoutIndex\":1,\"zoneIndex\":1,\"sectionIndex\":1,\"sectionFactor\":12,\"controlIndex\":1},\"addedFromPersistedData\":true,\"innerHTML\":\"<p>Employee name: {Nominee}</p><p>Department: {Nominee Unit}</p><p>Description: {One to three lines…}</p>\"},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true,\"isSpellCheckEnabled\":true,\"globalRichTextStylingVersion\":1,\"rtePageSettings\":{\"contentVersion\":5},\"isEmailReady\":false}}]"
LayoutWebpartsContent
:
"[{\"id\":\"1ee8960a-2fa0-4145-b9bb-e818f6cf18e7\",\"instanceId\":\"1ee8960a-2fa0-4145-b9bb-e818f6cf18e7\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{\"baseUrl\":\"https://dalu.sharepoint.com/sites/medit-development\"},\"componentDependencies\":{\"layoutComponentId\":\"8ac0c53c-e8d0-4e3e-87d0-7449eb0d4027\"}},\"dataVersion\":\"1.0\",\"properties\":{\"hideWebPartWhenEmpty\":true,\"isEditMode\":true,\"isEnabled\":false,\"layoutId\":\"FilmStrip\",\"uniqueId\":\"06d47312-1d46-4845-b416-2da516f056c9\",\"dataProviderId\":\"RecommendedItems\",\"webId\":\"f178f91e-6af0-49fe-aace-54bd48f44d7b\",\"siteId\":\"d4e8407f-c386-4f50-b936-1c6766c25266\"},\"containsDynamicDataSource\":false,\"reservedHeight\":356},{\"id\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"instanceId\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"title\":\"Title area\",\"description\":\"Title Region Description\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{}},\"dataVersion\":\"1.4\",\"properties\":{\"title\":\"getpayload\",\"imageSourceType\":4,\"layoutType\":\"FullWidthImage\",\"textAlignment\":\"Left\",\"showTopicHeader\":false,\"showPublishDate\":false,\"topicHeader\":\"\",\"enableGradientEffect\":true,\"isDecorative\":true,\"authors\":[{\"id\":\"i:0#.f|membership| myworkemail@email.ca \",\"upn\":\"medcomm@dal.ca\",\"email\":\"MyWorkemail@email.Ca\",\"name\":\"My Work Email\",\"role\":\"My work email\"}],\"authorByline\":[\"i:0#.f|membership|myworkemail@email.ca\"],\"hasTitleBeenCommitted\":true},\"containsDynamicDataSource\":false,\"reservedHeight\":280}]"
Title
:
"getpayload"
TopicHeader
:
""
__metadata
:
{type: "SP.Publishing.SitePage"}