SharePoint 2010  Sandboxed Solutions Created 08/8/2009 Srini Sistla
About me ©COMSYS. ALL RIGHTS RESERVED Srini Sistla Sr. SharePoint Consultant / SME / MCTS / Speaker / Trainer [email_address]
Knowing the audience How many of you are developers? How many of you are administrators? All others How many of you have already seen SPS 2010? How many of you have hands on SPS 2010? ©COMSYS. ALL RIGHTS RESERVED
Agenda Existing Challenges Sandboxed Solutions Demo(s)  Monitor Validate ©COMSYS. ALL RIGHTS RESERVED
Existing Challenges ( Developers ) Deployment Limitations wrt permissions What if you have post deployment changes? Monitoring  Performance Farm / Server Outages ©COMSYS. ALL RIGHTS RESERVED
Existing Challenges ( Administrators ) Cant view the code; is it trusted? Re-deployment on changes Memory leaks / Undisposed Objects Resource Consumption Performance Farm / Server Outages Server restarts ©COMSYS. ALL RIGHTS RESERVED
Sandboxed Solutions Packages (  . wsp   ) that can be  Added   ( Uploaded   ) to Solution Gallery and  Deployed   ( Activated  )  at  Site Collection  level with Site Collection  Administrator   rights.  Allow Partial Trust Code executes as in Sandbox  ©COMSYS. ALL RIGHTS RESERVED
Types of Solutions Farm Solutions Runs on W3 WorkerProcess Deployed by Farm Admins Artifacts are deployed to file system Runs under Full Trust SandBoxed Solutions Runs on SPUCWorkerProcess Deployed by Site Collection Admins Artifacts are deployed to database Runs under partial Trust ©COMSYS. ALL RIGHTS RESERVED
Why use SBS? Isolation Deployed to the database ( no files within the SBS will touch file system ). Runs under special process, SPUCWorkerProcess.exe Assign Resource Points Doesn’t effect other Site Collections No waiting on farm admins to deploy your solutions Farm admins don’t need to worry about bad solutions any more ©COMSYS. ALL RIGHTS RESERVED
Why use SBS? ( Cont… ) Runs on partial trust ( own CAS policy ) Can be monitored Can be validated Hosting issues in corporates are solved Easy to manage hosted environments and Quick TAT ©COMSYS. ALL RIGHTS RESERVED
Stages ©COMSYS. ALL RIGHTS RESERVED
When Should you use SBS? and Elements “ By default its preferred to use SBS solutions always”  We can create the following using SBS Web Parts ( System.Web.UI.WebControls.Webparts.WebPart ) List ( Definitions & Instances ) Custom Actions Event Receivers ( on items, list and webs ) Content Types/Fields Module/files Feature callouts Workflows … ©COMSYS. ALL RIGHTS RESERVED
Introducing my VM 4096 MB / Dual Core / 60GB HDD Windows Server 2008 Standard Edition SharePoint Server 2010 Beta 2 Visual Studio 2010 Beta 2 SQL Server 2008 Office Professional Edition 2010 Beta ©COMSYS. ALL RIGHTS RESERVED
DEMO # 1 Setup your environment, Creating a SBS, Deploy, Debug ©COMSYS. ALL RIGHTS RESERVED
Setup your environment Activate User Code Service Configure quotas and locks Add ACL Access Rules using PowerShell on a Domain Controller ©COMSYS. ALL RIGHTS RESERVED
Sandboxed Solutions Process ©COMSYS. ALL RIGHTS RESERVED Solution gallery Web Part gallery Root SPWeb of SPSite WebParts.wsp Per-WFE  AssemblyCache Sandboxed Code  Service
Execution Details ©COMSYS. ALL RIGHTS RESERVED Front End Execution Manager Back End Host Service Worker Process Full Object Model Untrusted Code Subset of Object Model
Following cannot be created using SBS Cannot use SPSecurity et all classes Web Application and Farm scoped Features Layouts Folders in the solution Sending Emails (SPUtility.SendEmail) Custom Action Groups HideCustomAction element Content Type Binding Timer Jobs  … ©COMSYS. ALL RIGHTS RESERVED
DEMO # 2 What you can’t do ©COMSYS. ALL RIGHTS RESERVED
Solution Restrictions ©COMSYS. ALL RIGHTS RESERVED CA > System Settings > Farm Management > Manage User Solutions
DEMO # 3 Restrict a Solution ©COMSYS. ALL RIGHTS RESERVED
Monitoring Site collection quotas specify the warning and hard limits for number of resources that can be used per day Sum  of resource measures are taken across solutions deployed to site collection i.e.: add up CPU Points for all solutions Max  of resource utilization measures checked against site collection quota to determine if it should be throttled/blocked ©COMSYS. ALL RIGHTS RESERVED
Monitored Resources ©COMSYS. ALL RIGHTS RESERVED
Monitoring > Quotas ©COMSYS. ALL RIGHTS RESERVED CA > Application Management > Site Collections > Configure quotas
Validations Validate based on the requirements Restrict if needed Runs at Farm Level Validate solutions when installed or changed SP Solution Validator Template @ http://spsolutionvalidator.codeplex.com ©COMSYS. ALL RIGHTS RESERVED
DEMO # 4 Solution Validator ©COMSYS. ALL RIGHTS RESERVED
References ©COMSYS. ALL RIGHTS RESERVED
References > Sahil Malik Sahil is a Microsoft techie. Sahil has been a Microsoft MVP, INETA Speaker, a .NET author, consultant and trainer for the past many years. You can find him in a regular SharePoint column in code-magazine. Sahil’s Next Book (Available April 2010)
References > Websites / Video’s  http://msdn.microsoft.com/en-us/magazine/ee335711.aspx http://channel9.msdn.com/learn/courses/SharePoint2010Developer/SandboxedSolutions/  ( Videos by Andrew Connell ) http://blogs.msdn.com/pandrew/ ( Videos and blog by Paul Andrew ) ©COMSYS. ALL RIGHTS RESERVED
Questions and Contact ©COMSYS. ALL RIGHTS RESERVED

SharePoint 2010 Sandboxed Solution

  • 1.
    SharePoint 2010 Sandboxed Solutions Created 08/8/2009 Srini Sistla
  • 2.
    About me ©COMSYS.ALL RIGHTS RESERVED Srini Sistla Sr. SharePoint Consultant / SME / MCTS / Speaker / Trainer [email_address]
  • 3.
    Knowing the audienceHow many of you are developers? How many of you are administrators? All others How many of you have already seen SPS 2010? How many of you have hands on SPS 2010? ©COMSYS. ALL RIGHTS RESERVED
  • 4.
    Agenda Existing ChallengesSandboxed Solutions Demo(s) Monitor Validate ©COMSYS. ALL RIGHTS RESERVED
  • 5.
    Existing Challenges (Developers ) Deployment Limitations wrt permissions What if you have post deployment changes? Monitoring Performance Farm / Server Outages ©COMSYS. ALL RIGHTS RESERVED
  • 6.
    Existing Challenges (Administrators ) Cant view the code; is it trusted? Re-deployment on changes Memory leaks / Undisposed Objects Resource Consumption Performance Farm / Server Outages Server restarts ©COMSYS. ALL RIGHTS RESERVED
  • 7.
    Sandboxed Solutions Packages( . wsp ) that can be Added ( Uploaded ) to Solution Gallery and Deployed ( Activated ) at Site Collection level with Site Collection Administrator rights. Allow Partial Trust Code executes as in Sandbox ©COMSYS. ALL RIGHTS RESERVED
  • 8.
    Types of SolutionsFarm Solutions Runs on W3 WorkerProcess Deployed by Farm Admins Artifacts are deployed to file system Runs under Full Trust SandBoxed Solutions Runs on SPUCWorkerProcess Deployed by Site Collection Admins Artifacts are deployed to database Runs under partial Trust ©COMSYS. ALL RIGHTS RESERVED
  • 9.
    Why use SBS?Isolation Deployed to the database ( no files within the SBS will touch file system ). Runs under special process, SPUCWorkerProcess.exe Assign Resource Points Doesn’t effect other Site Collections No waiting on farm admins to deploy your solutions Farm admins don’t need to worry about bad solutions any more ©COMSYS. ALL RIGHTS RESERVED
  • 10.
    Why use SBS?( Cont… ) Runs on partial trust ( own CAS policy ) Can be monitored Can be validated Hosting issues in corporates are solved Easy to manage hosted environments and Quick TAT ©COMSYS. ALL RIGHTS RESERVED
  • 11.
    Stages ©COMSYS. ALLRIGHTS RESERVED
  • 12.
    When Should youuse SBS? and Elements “ By default its preferred to use SBS solutions always” We can create the following using SBS Web Parts ( System.Web.UI.WebControls.Webparts.WebPart ) List ( Definitions & Instances ) Custom Actions Event Receivers ( on items, list and webs ) Content Types/Fields Module/files Feature callouts Workflows … ©COMSYS. ALL RIGHTS RESERVED
  • 13.
    Introducing my VM4096 MB / Dual Core / 60GB HDD Windows Server 2008 Standard Edition SharePoint Server 2010 Beta 2 Visual Studio 2010 Beta 2 SQL Server 2008 Office Professional Edition 2010 Beta ©COMSYS. ALL RIGHTS RESERVED
  • 14.
    DEMO # 1Setup your environment, Creating a SBS, Deploy, Debug ©COMSYS. ALL RIGHTS RESERVED
  • 15.
    Setup your environmentActivate User Code Service Configure quotas and locks Add ACL Access Rules using PowerShell on a Domain Controller ©COMSYS. ALL RIGHTS RESERVED
  • 16.
    Sandboxed Solutions Process©COMSYS. ALL RIGHTS RESERVED Solution gallery Web Part gallery Root SPWeb of SPSite WebParts.wsp Per-WFE AssemblyCache Sandboxed Code Service
  • 17.
    Execution Details ©COMSYS.ALL RIGHTS RESERVED Front End Execution Manager Back End Host Service Worker Process Full Object Model Untrusted Code Subset of Object Model
  • 18.
    Following cannot becreated using SBS Cannot use SPSecurity et all classes Web Application and Farm scoped Features Layouts Folders in the solution Sending Emails (SPUtility.SendEmail) Custom Action Groups HideCustomAction element Content Type Binding Timer Jobs … ©COMSYS. ALL RIGHTS RESERVED
  • 19.
    DEMO # 2What you can’t do ©COMSYS. ALL RIGHTS RESERVED
  • 20.
    Solution Restrictions ©COMSYS.ALL RIGHTS RESERVED CA > System Settings > Farm Management > Manage User Solutions
  • 21.
    DEMO # 3Restrict a Solution ©COMSYS. ALL RIGHTS RESERVED
  • 22.
    Monitoring Site collectionquotas specify the warning and hard limits for number of resources that can be used per day Sum of resource measures are taken across solutions deployed to site collection i.e.: add up CPU Points for all solutions Max of resource utilization measures checked against site collection quota to determine if it should be throttled/blocked ©COMSYS. ALL RIGHTS RESERVED
  • 23.
    Monitored Resources ©COMSYS.ALL RIGHTS RESERVED
  • 24.
    Monitoring > Quotas©COMSYS. ALL RIGHTS RESERVED CA > Application Management > Site Collections > Configure quotas
  • 25.
    Validations Validate basedon the requirements Restrict if needed Runs at Farm Level Validate solutions when installed or changed SP Solution Validator Template @ http://spsolutionvalidator.codeplex.com ©COMSYS. ALL RIGHTS RESERVED
  • 26.
    DEMO # 4Solution Validator ©COMSYS. ALL RIGHTS RESERVED
  • 27.
    References ©COMSYS. ALLRIGHTS RESERVED
  • 28.
    References > SahilMalik Sahil is a Microsoft techie. Sahil has been a Microsoft MVP, INETA Speaker, a .NET author, consultant and trainer for the past many years. You can find him in a regular SharePoint column in code-magazine. Sahil’s Next Book (Available April 2010)
  • 29.
    References > Websites/ Video’s http://msdn.microsoft.com/en-us/magazine/ee335711.aspx http://channel9.msdn.com/learn/courses/SharePoint2010Developer/SandboxedSolutions/ ( Videos by Andrew Connell ) http://blogs.msdn.com/pandrew/ ( Videos and blog by Paul Andrew ) ©COMSYS. ALL RIGHTS RESERVED
  • 30.
    Questions and Contact©COMSYS. ALL RIGHTS RESERVED

Editor's Notes