Saturday, January 12, 2013

SharePoint 2010 Sandbox solution limitation

Below of these artifacts cannot be used in SharePoint 2010-Sandbox solution.

First thing is whatever the code which deals with outside of the server its not possible in Sandbox. Example: SPUtility.SendEmail method It needs to communicate with email server.

System.Net.Mail : This method can be used in classic asp.net web application or Farm solution in SharePoint but not in Sandbox solution. If you trying to send an email using this classes in your sandbox solution,It will compiles successfully but in run time it will throw SecurityException.

If you want to achieve this in sandbox solution then consider the Silverlight webpart with WCF or web service.

Next is the code which is trying to alter or create the pages in the file system in SharePoint Server is not allowed in Sandbox.

  • Application Pages
  • Mobile Pages
  • Site Definition and
  • UserControl(.ascx) - Visual WebPart.
  • Few tools available in CodePlex to create the Sandboxed visual webpart but it comes up with limitation that means some of the server object model and SharePoint controls cannot be used in it.

    Instead of using the visual webpart you can consider the ASP.NET WebPart in Sandbox solution.

    Finally,As soon as you select the solution type in Visual Studio for Sandbox solution VS will add the trimmed the features in Microsoft.SharePoint.dll.