In Sharepoint 2007/ 2010 not sandboxed you could place images/css/javascripts etc. somewhere in Sharepoint root folder or in wpresources folder.
What is a good/working place to put these files in sandboxed solutions?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The goal was to have something resembling the usual structure with folders, subfolders, where you can just drop images and other client side files and reference them by relative url.
And at the end the solution was to create a module with files, which is fairly easy in Visual Studio 2010 – Add new item -> Sharepoint -> Module.
Then you can just create/drop files/folders there, and the files list in elements.xml is maintained by Visual Studio. They are not included in any library, but can be referenced and loaded as needed.
One important thing is to give the module unique name or add Url attribute (which is url prefix), so that it would not conflict with files from other solutions.
You reference files then using
Or, if you specified Url in elements.xml (
<Module Name="YourModuleName" Url="YourUrl">)If you deploy feature with module at a web scope,
webisSPContext.Current.Web, and at a site scope it isSPContext.Current.Site.RootWebAnd if there is a need to actualy get contents of the file, you can do that with
An article on including javascript files in particular, which uses module here.