I'm trying to automatically create a SharePoint page when a SharePoint item is created. I found a YouTube tutorial on the process but I'm getting an unexpected error. The error occurs on the 'Get file metadata' step (first screenshot). I'm new to all of this so any help is greatly appreciated!
Here is the error:
Route did not match
clientRequestId: d9d3f6f0-d20c-4579-b848-097c05de492f
serviceRequestId: d9d3f6f0-d20c-4579-b848-097c05de492f
Here is my flow:
Hi @Expiscornovus,
I stumbled on this thread as I'm having the same issue as @Collinjay. I expected the issue had to do with spaces in the filename, and so was excited to find your solution to encode a replacement of the '-' in place of the spaces, but I find that I have the same file not found error when I do this encoding. If I rename the file to eliminate the spaces, no error...
I create a super simple flow just to duplicate the problem set to share here in the event you have additional thoughts on troubleshooting. Thanks in advance for any help you can provide!
The expression value is:
encodeUriComponent(concat('/SitePages/',replace(triggerBody()['text'], ' ', '-'),'.aspx'))
When the filename has spaces "Beta Project 10_18_01.aspx", I get the error, and the raw inputs are with the - substituted for the spaces:
{
"host": {
"connectionReferenceName": "shared_sharepointonline",
"operationId": "GetFileMetadata"
},
"parameters": {
"dataset": "https://company.sharepoint.com/sites/SharePointSiteName",
"id": "%2FSitePages%2FBeta-Project-10_18_01.aspx"
}
}
When the filename has been renamed to have no spaces "BetaProject10_18_01.aspx", I get no error, and the raw inputs are:
{
"host": {
"connectionReferenceName": "shared_sharepointonline",
"operationId": "GetFileMetadata"
},
"parameters": {
"dataset": "https://company.sharepoint.com/sites/SharePointSiteName",
"id": "%2FSitePages%2FBetaProject10_18_01.aspx"
}
}
Hi @Expiscornovus ,
Thanks for your continued help with this. I truly appreciate it.
Page name example: 105__Monday test 01.aspx
Page title example: Daily Dose Template
I have a dynamic value in the page name to avoid duplicate page names. The dynamic value I've been using is the Form ID (my overall process for this is MS Forms submission > SharePoint item > SharePoint page). Each page name begins with the Form ID. In the example above, it's the "105."
The page title for these pages is always "Daily Dose Template." I don't want it to be that, but somewhere along the line, Power Automate uses the page template's title. I would like Power Automate to change the page title so it's the same as the page name (or close to it if there are any special characters).
Hi @Collinjay,
A title of a page and a file name (and the file identifier) of a page can be different. Like mentioned earlier, this is because of special characters (Microsoft will change those characters in the filename).
That's why it would help if you can show me the specific title value which you used in your testing. This way I can reproduce the issue and find a fix for you.
Below is an example where I used the '#Testing &*%' as a Title value in my list item which triggers the flow. SharePoint ends up creating it with the -Testing-&--.aspx filename.
Hopefully this clarifies things?
Hi @Expiscornovus ,
The name of the list item is the same as the page I'm trying to create. Should they be different in some way?
Below is a screenshot of the outputs. The code wouldn't all fit in the Power Automate window (without having to scroll) so I copied the code to an online editor and took a screenshot of it there. That's why the formatting is different.
Hi @Collinjay,
What was the title of the list item which triggered the flow?
And can you also make a screenshot of the outputs section of the Send an HTTP request to SharePoint action in the flow run history. The action you are using to make a copy of a page?
Hi @Expiscornovus ,
After entering your expression the right way (facepalm), I get an error that says "File not found."
Not sure if a screenshot is a helpful, but here's a screenshot of the error.
Hi @Collinjay,
I see you have added it as plain text. Can you add the expression via the expression tab?
Hi @Expiscornovus ,
The Title value I'm using is from 'When an item is created.'
Below is a screenshot of how I used your expression in my flow. Is that how I should do it?
Hi @Collinjay,
Can you share a screenshot where you inserted the expression? Can you als share which Title value you used in your test?
Hi @Expiscornovus ,
Thank you for helping me out. Unfortunately the expression you provided did not work. Since I'm new to all of this, I wasn't sure if the parts right after body/Title were necessary, or just an example so I tried both
encodeUriComponent(concat('/SitePages/',replace(triggerOutputs()?['body/Title'], ' ', '-'),'.aspx'))
and
encodeUriComponent(concat('/SitePages/',replace(triggerOutputs()?['body/Title']),'.aspx'))
but I got the same error message as before.
I also tried replacing 'Get file metadata' with 'Get file metadata using path'. That seemed to work but I got an error on my last step. The error message is "Bad gateway." Is that something you can help with here? Or should I create a new post?
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2