SharePoint Saturday - Sandbox development


Published on

This session will cover what you can and can’t do in sandboxed environments such as Office 365 or an on premise sandboxed environment. This session is not about SharePoint designer customizations , it’s will cover code instead !
Topics covered include: sandboxed solutions, client object model, web services and how to configure a development environment for testing.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Evolving storyPainful start slow, but don’t discount the whole ideaLots of concepts that have good merit and the practise of moving towards architecting solutions that can run on tightly governed sharepoint platforms regardless of location is where many believe the industry will be heading.
  • HLD – preapproved solutions still require HLD, before any custom code.Design guidelines:Specific structureEfficient code
  • HLD – preapproved solutions still require HLD, before any custom code.Design guidelines:Specific structureEfficient code
  • Error handlingCross site collection and/or different permissions
  • UploadUploaded to Solution GalleryRequires Site Collection adminActivationActually deploys files, registers Event Receivers, etc.Site Collection features activatedSite features must be activated manuallyDeactivationDisables capabilitiesDeletionRemoves the solutionUpgradeUse the same solution ID, different nameFeatures are compared, new features activated
  • Protects Site Collection from resource intensive solutionsResource Points measure resource consumptionResourceMeasure is what is measuredResourcePerPoint is how points are calculatedSite Collection Quota limits resource consumption per daySummed across all solutionsAll solutions are deactivatedAbsolute Limit limits resources consumed by a solutionHard limit of resources consumed in a requestRestarts worker process
  • SharePoint 2010 allows customizations to be deployed and maintained at the site collection level. Increasing agility while releasing burden on IT.Of course there is still IT involvement, but mainly when things go wrong (such as excessive resource usage).
  • Create sandbox visualwebpartAdd bad code, compileAdd good code , compileUpload to solution galleryActivate and useChange code, rename and try again
  • Code can either be executed locally on the machine that receives the request, or on a load-balanced back-end server. The User Code Service needs to run on the machine executing the request.
  • Develop and debug on-premisesVisual Studio 2010F5 DebuggingConfirm solution in staging site collectionDedicated site collection to dev teamUpload *.wspAcceptance testingDeploy *.wsp uploaded to Solution Gallery
  • New APIs for interacting with SharePoint sitesEasier than SharePoint Web Services, more efficientConsistent with Microsoft.SharePoint namespaceScoped to site collection, scoped for downloadSupported platforms.NET 3.5 (and below)Silverlight 2.0 (and above)JavaScript/JscriptProvides a means to call services outside SharePoint Online
  • SharePoint Saturday - Sandbox development

    1. 1. Developing in the Sandbox<br />Elaine van BergenOBS<br />
    2. 2.
    3. 3. Who am I<br />SharePoint 2010 MCM<br />SharePoint MVP<br />Microsoft Virtual Technical Solutions Professional<br />Co-organiser of Melbourne SharePoint User Group (MSPUG)<br />@laneyvb on Twitter<br />Blog at<br />
    4. 4.
    5. 5. 3 Types<br />On-premise sandbox<br />SharePoint online<br />SharePoint online dedicated<br />
    6. 6. Design Process for Customisation<br />High Level Design (HLD) – approval<br />Follow design guidelines<br />Verify/Submit with MSOCAF<br />
    7. 7. MSOCAF<br />Developing in the Sandbox<br />
    8. 8. 3 Types<br />On-premise sandbox<br />SharePoint online<br />SharePoint online dedicated<br />
    9. 9. Setup Development Environment<br />Enable Microsoft SharePoint Foundation Sandboxed Code Service via CA<br />Download power tools<br />Download Silverlight toolkit;silverlight4toolkit;riaservicestoolkit<br />
    10. 10. Sandbox Execution<br />FRONT END<br />BACK END<br />User Code Service (SPUCHostService.exe)<br />Execution Manager(Inside Application Pool)<br />Sandbox Worker Process<br />(SPUCWorkerProcess.exe)<br />IIS(WPW3.EXE)<br />Web.config / CAS Policies<br />Untrusted Code<br />SP Object Model Subset<br />Subset-Model Request<br />Sandbox Worker Proxy Process<br />(SPUCWorkerProcessProxy.exe)<br />Access restricted by CAS policy<br />Full SP Object Model<br />
    11. 11. Sandboxed Solutions Support<br />
    12. 12. API Scope<br />Subset of Microsoft.SharePoint<br />Scoped to SPSite/Site Collection and below<br />Site Columns<br />Content Types<br />List Definitions<br />List Instances<br />Web Parts<br />Workflows<br />Custom Actions<br />SharePoint Designer workflow activities<br />Event Receivers<br />Modules/Files<br />
    13. 13. CAS Policy<br />wss_usercode.config<br />%ProgramFiles%Common FilesMicrosoft Sharedweb server extensions14CONFIG <br />SharePointPermission.ObjectModel<br />SecurityPermission.Execution<br />AspNetHostingPermission = Minimal<br />WebPermission.Connect<br />
    14. 14. Unsupported Features<br />Anything above the site collection<br />Access to External Code/Data<br />Creation of SPWeb/SPSite outside of context<br />SPSecurity<br />BCS<br />
    15. 15. Sandbox Deployment<br />
    16. 16. Solution Monitoring<br />Protects Site Collection from resource intensive solutions<br />Resource Points measure resource consumption<br />Site Collection Quota limits resource consumption per day<br />Absolute Limit limits resources consumed by a solution<br />
    17. 17. Monitored Resources<br />
    18. 18. SharePoint 2010 Approach<br />Developers build custom solutions<br />Administrators leverage resource monitors to check site collection usage<br />Site collection owners deploy, activate and implement the customizations<br />
    19. 19. On-Premise Sandbox<br />Developing in the Sandbox<br />
    20. 20. Solution Validation<br />[GuidAttribute("34805697-1FC4-4b66-AF09-AB48AC0F9D97")]<br />public class PublisherValidator: SPSolutionValidator{<br /> [Persisted]<br /> List<string> _allowedPublishers;<br /> public override void ValidateSolution(<br /> SPSolutionValidationProperties properties){<br /> }<br /> public override void ValidateAssembly(<br /> SPSolutionValidationProperties properties,<br /> SPSolutionFile assembly){<br /> }<br />}<br />
    21. 21. Full trust proxy<br />Operations in class that inherits Microsoft.SharePoint.Usercode.SPProxyOperation<br />Arguments in serializable class that inherits Microsoft.SharePoint.Usercode.SPProxyOperationArgs<br />Register full trust proxy<br />Recycle user code service<br />Consume via SPUtility.ExecuteRegisteredProxyOperation<br />
    22. 22. Load Balancing<br />Sandboxed solutions can be run in two modes:<br />Local Mode:<br />Execute code on WFE<br />Low administration overhead<br />Lower scalability<br />Remote Mode:<br />Execute on dedicated SharePoint servers<br />Load balanced distribution of code execution requests<br />
    23. 23. 3 Types<br />On-premise sandbox<br />SharePoint online<br />SharePoint online dedicated<br />
    24. 24. Limited web services<br /><br />
    25. 25. Development Process<br /><br /><br />*.wsp<br />Develop/ Debug<br />*.wsp<br />F5<br />Upload/ Activate/ Deactivate<br />*.wsp<br /><br />
    26. 26. Getting to data<br />
    27. 27. Client-Object Model<br />New APIs for interacting with SharePoint sites<br />Supported platforms<br />.NET 3.5 (and below)<br />Silverlight 2.0 (and above)<br />JavaScript/Jscript<br />Provides a means to call services outside SharePoint Online<br />
    28. 28. Equivalent Objects<br />Member names mostly the same from server to client (e. g., SPWeb.QuickLaunchEnabled = Web.QuickLaunchEnabled)<br />
    29. 29. Architecture/Execution<br />ECMAScriptControlsand Logic<br />Browser<br />Client.svc<br />Server OM<br />JSON Response<br />ECMAScript OM<br />XML Request<br />Proxy<br />XML Request<br />Contentdatabase<br />Proxy<br />JSON Response<br />Managed OM<br />Managed Client<br />Managed Controls and Logic<br />SharePoint Server<br />
    30. 30. SharePoint ONLINE<br />Developing in the Sandbox<br />
    31. 31. Authentication<br />
    32. 32. Authentication <br />Claims + Federation + Multiple Authentication Providers<br />FedAuth cookie with HTTP Only Flag = WinInet.dll <br /><br />
    33. 33. Question and Answer<br />