Cannot make a cache safe URL for “1033/sp.js”, file not found

I was playing around with writing WebParts and using the SharePoint Javascript Client Object Model (COM – I wish people would standardise this acronym soon!). I added a ScriptLink to SP.js but got this error:

Cannot make a cache safe URL for “1033/sp.js”, file not found. Please verify that the file exists under the layouts directory.

My code inside the CreateChildControls() method is as below:

ScriptLink scriptLink = new ScriptLink()
                                        {
                                            ID = "WebPartClientConsumer",
                                            Name = "sp.js",
                                            LoadAfterUI = true
                                        };

this.Controls.Add(scriptLink);

It turns out that the problem is I didn’t specify Localizable = false for the ScriptLink object.

If the script link is localizable (default), then SP will look for it under the LAYOUTS\1033 folder (the ‘1033’ is determined by the language of your OS). If it is not localizable, then SP will look for it under the LAYOUTS folder, which is where it is installed by default.

Unknown's avatar

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in Client Object Model, SharePoint. Bookmark the permalink.

Leave a comment