Call Sandbox from Farm solution
-
Saturday, January 12, 2013 1:01 PM
Does anyone know how to call some sandboxed code from a farm solution i.e. the opposite of a Full Trust Proxy?
It seems like it should be possible using some of the classes from within the Microsoft.SharePoint.Administration namespace but I haven't found any documentation about it.
All Replies
-
Sunday, January 13, 2013 1:00 PM
-
Sunday, January 13, 2013 1:23 PM
I understand that the sandbox is isolated but this is really only an issue when you are running in the sandbox. There must be a way to call some sandboxed code from a farm solution - sharepoint does it somehow.
The reasons behind wanting to do this is that there are a few things which simply cannot be done using a sandbox solution e.g. a web service hosted in sharepoint - allowing a farm solution to call a sandboxed solution would enable me to write a very thin wrapper for the service in the farm solution but the majority of the functionality would sandboxed.
-
Sunday, January 13, 2013 8:17 PM
SharePoint would be able to call these assemblies, because it has internal knowledge on the location of the assemblies and how they are stored. There are no public API's that will allow you to get the assemblies and call them. Building a solution for obtaining the assemblies from for example the content database would be complex and will result in a lot of code that is hard to upgrade to the next version of SharePoint. (not supported in also) I would not suggest putting any effort into this.
-
Sunday, January 13, 2013 10:41 PM
I'm not trying to do this in an unsupported way, I just wish to use the classes exposed by Microsoft if possible. I see that there are classes within Microsoft.SharePoint.UserCode (http://msdn.microsoft.com/en-us/library/ee543678.aspx) that look like they would be useful (SPUserCodeExecutionManager and SPUserCodeExecutionContext for example). These classes are available in 2013.
To be clear, I don't want to manually locate and deserialise the assemblies from the content db, I just want to understand whether I can use the object model to do this.
-
Monday, January 14, 2013 9:18 PM
Retrieving the sandboxed assemblies from SharePoint would not be possible using any of the API's that are available. I browsed through the Microsoft.SharePoint.UserCode classes and this API does not serve this purpose.
You also might want to read this article:
http://msdn.microsoft.com/en-us/library/gg615461.aspx
This is the reference to the SharePoint 2010 UserCode API's:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.usercode(v=office.14).aspx
- Marked As Answer by Hemendra AgrawalMicrosoft Community Contributor, Moderator Thursday, January 24, 2013 4:15 PM

