Thursday, 1 September 2016

SharePoint: Cannot file "Style%2520Library/Js/myfile.js"

I recent SharePoint deployment raised the interesting error about a missing file. When I checked the expected folder, the file was there so the error seemed a little strange.

The solution is in the message:
The missing file is Style%2520Library.

The cause was an incorrect link reference in the masterpage. The link was set to
<SharePoint:ScriptLink Name="~SiteCollection/Style%20Library/JS/myfile.js" runat="server" ID="ScriptLink2" />

SharePoint is url encoding the value. The encoded value of '%' is '%25', which results in the strange url.

I removed the %20 from the link address and the issue was resolved.

No comments:

Post a comment