Hi I am having the follow error on my flow. What I am trying to do is, whenever an item is added to Sharepoint OnPrem List, create a news page on Sharepoint Online. Here is the error:
URI: /_api/web/GetFileByServerRelativeUrl('/sites/spfx/sitepages/NewsTemplate.aspx')/copyto('/sites/spfx/sitepages/Test8.aspx')
Hi @knishal,
Did you add the expression in the File Identifier field in the same way as in the animation below?
Can you also double check that your title/name field has the same internal name as in my expression. I used Title_x002f_Name. Your field could be different.
If it is different you also need to update the expression so that it will be using your specific internal field name.
You can check that via the peek code in a compose. Or just hover over it. That is in the second part of the same animation below.
Tried that, didnt work too 😞 Same error.
Hi @knishal,
Can you add the previous code snippet via the expression editor/tab instead of pasting it as plain text?
Hi @knishal,
I would use some encoding in the File Identifier.
You could use the encodeUriComponent function for this.
In your setup that would be probably something like below:
encodeuricomponent(concat('/SitePages/', triggerOutputs()?['body/Title_x002f_Name'], '.aspx'))
@ExpiscornovusI see the issue and it works now. I will accept that as a solution. I have another Issue and dont want to create another post. Moving on from that step, I have an issue with getting the file meta data.
Flow:
Error:
Any idea on how I can resolve this?
Hi @knishal,
It looks like it cannot find the original page, which it tries to copy. The NewsTemplate page does exist within the spfx site, correct?
And another check. Are you using the same site name in the Uri value as in the Site Address dropdown?
Hi @Expiscornovus I tried that and its giving me the same error:
Hi @knishal,
Can you try this for the URI:
_api/web/getfilebyserverrelativeurl('/sites/spfx/SitePages/NewsTemplate.aspx')/copyto(strnewurl='/sites/spfx/SitePages/Test8.aspx',boverwrite=false)
I see the copyto method also has strnewurl & boverwrite parameters:
Below is an example in a Send an HTTP request to SharePoint action.