Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a webpart deployed as a sandbox solution. The webpart has resource files, javascript files, css styles, and images. Where would I deploy all these in a sandbox solution (Office 365)?

Thanks!

share|improve this question

4 Answers 4

up vote 1 down vote accepted

I did some research and found this answer: http://joelblogs.co.uk/2011/06/30/embedding-resources-in-sandbox-solutions/

This works for all my files, except the resource files...Not sure how I would do those

share|improve this answer

I use Style library and make a folder for every category like images,scripts,styles

share|improve this answer

In my 365 projects, I created a folder called "Modules" inside the "Modules" folder I created another folder called "Scripts", "Images" and "Css", and I put my files in theses folder.

You can create a class what inherits a WebPart and create an override method for OnInit. From there you can create a new literal control

Controls.AddAt(0, new LiteralControl("<script type=\"text/javascript\"> window.jQuery || document.write('<script src=\"" + WebUrl + "/path_your_module/Scripts/jquery-1.7.1.min.js\"><\\/script>');</script>"));

WebUrl is a property with the url of your site.

Don't forget to inherit it in your webpart within the class you created!

share|improve this answer

This article is about localization in Sandbox, but it shows the method to access the resource files properly.

http://msdn.microsoft.com/en-us/library/gg615453.aspx

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.