Attempting to migrate a web part solution from farm solution to sandbox solution. The steps I have seen online outline changing a property at the project level which is a boolean called 'Sandbox Solution'. However I do not see this option when I view the properties of the project. Does anyone have and ideas on how to migrate a solution which contains multiple web parts from a farm solution to sandbox?
1 Answers
I am afraid this can't be done. When a farm solution is created and deployed it loads extra controls into the solution that allows the solution to easily access data outside of its container. An example is the user control. This control is not allowed in a Sandbox solution as it allows access to the SharePoint root. Just changing that option isn't going to revert that option because the entire solution is geared around it even if you don't use it. It will be deployed. I found the blog post you are talking about or one similar to it and have never seen that work. This is why you define your project type at the beginning because Visual Studio applies the different controls depending on your selection. Removing the sandbox and recompiling will not work.
On another note, you can however convert a sandbox solution to a farm solution. This is because you are moving from stronger security to "less"

- 799
- 2
- 8
- 21
-
Maybe I can create a new sandbox solution and begin importing some of the classes. Very new to visual studio dev, I am a java developer.. – user2524908 Jan 22 '16 at 14:56
-
I see options where you can import cab web parts into other solutions. Could this potentially work to import it into a sandbox project? – user2524908 Jan 22 '16 at 15:01
-
I think it may. I haven't attempted what you are doing before. The biggest thing you have to remember is that Sandbox solutions are not allowed out of their site. If you need data from other sites or even from the file system, it will not work. – David Drever Jan 23 '16 at 21:23
-
When you say data is not allowed from other sites. Could you have an iframe which contained another site within the portlet on a sandbox(office 365 sharepoint?) – user2524908 Jan 25 '16 at 15:18
-
I do not believe so. The Sandbox was designed to stop this usage. If you are in O365, why not simply build the application using the Add-In model and REST services? You can pretty much do anything you want that way. Here's a good place to start: https://msdn.microsoft.com/en-us/library/office/jj163794.aspx – David Drever Jan 25 '16 at 16:53