Upload
elaine-van-bergen
View
1.270
Download
2
Tags:
Embed Size (px)
DESCRIPTION
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.
Citation preview
SponsorsGold
Silver
Bronze
Developing in the Sandbox
Elaine van BergenOBS
Sydney 2011
Sydney 2011
Who am I
• SharePoint 2010 MCM• SharePoint MVP• Microsoft Virtual Technical Solutions
Professional• Co-organiser of Melbourne SharePoint User
Group (MSPUG)• @laneyvb on Twitter• Blog at http://laneyvb.blogspot.com/
Sydney 2011
Sydney 2011
3 Types
• On-premise sandbox
• SharePoint online• SharePoint online dedicated
Sydney 2011
Design Process for Customisation
• High Level Design (HLD) – approval
• Follow design guidelines http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=18128
• Verify/Submit with MSOCAFhttps://caf.sharepoint.microsoftonline.com/Default.aspx
Sydney 2011
MSOCAFDeveloping in the Sandbox
Sydney 2011
3 Types
• On-premise sandbox
• SharePoint online• SharePoint online dedicated
Sydney 2011
Setup Development Environment
• Enable Microsoft SharePoint Foundation Sandboxed Code Service via CA
• Download power toolshttp://visualstudiogallery.msdn.microsoft.com/8e602a8c-6714-4549-9e95-f3700344b0d9
• Download Silverlight toolkithttp://www.microsoft.com/web/gallery/install.aspx?appid=silverlight4tools;silverlight4toolkit;riaservicestoolkit
Sandbox Execution
Sandbox Worker Process(SPUCWorkerProcess.exe)
User Code Service (SPUCHostService.exe)Execution Manager
(Inside Application Pool)
IIS(WPW3.EXE)
FRONT END
Sandbox Worker Proxy Process(SPUCWorkerProcessProxy.exe)
Full SP Object Model
SP Object Model Subset
Untrusted Code
Web.config / CAS Policies
Subset-Model Request
Access restricted
by CAS policy
BACK END
Sydney 2011
Sandboxed Solutions SupportItem Template Sandbox
Compatible?Visual Web Part NoVisual Web Part (Sandboxed) Yes
Web Part YesSequential Workflow NoState Machine Workflow NoBusiness Data Connectivity Model
No
Application Page NoEvent Receiver YesModule YesContent Type YesList Definition From Content Type
Yes
List Definition YesList Instance YesEmpty Element YesUser Control No
Sydney 2011
API Scope• Subset of Microsoft.SharePoint• Scoped to SPSite/Site Collection and below– Site Columns– Content Types– List Definitions– List Instances– Web Parts– Workflows– Custom Actions– SharePoint Designer workflow activities– Event Receivers– Modules/Files
Sydney 2011
CAS Policy• wss_usercode.config– %ProgramFiles%\Common Files\Microsoft Shared\
web server extensions\14\CONFIG\ • SharePointPermission.ObjectModel• SecurityPermission.Execution• AspNetHostingPermission = Minimal• WebPermission.Connect
Sydney 2011
Unsupported Features
• Anything above the site collection• Access to External Code/Data• Creation of SPWeb/SPSite outside of context• SPSecurity• BCS
Sydney 2011
Sandbox Deployment
Upload
Activation
DeactivationDeletion
Upgrade
Sydney 2011
Solution Monitoring
• Protects Site Collection from resource intensive solutions
• Resource Points measure resource consumption
• Site Collection Quota limits resource consumption per day
• Absolute Limit limits resources consumed by a solution
Monitored ResourcesMetric Name Description Units Resources
Per PointAbsoluteLimit
AbnormalProcessTerminationCount Process gets abnormally terminated Count 1 1
CPUExecutionTime CPU exception time Seconds 3,600 60CriticalExceptionCount Critical exception fired Number 10 3
InvocationCount Number of times solution has been invoked Count N/A N/A
PercentProcessorTime Note: # of cores not factored inPercentage Units of Overall Processor Consumed
85 100
ProcessCPUCycles CPU Cycles 1E+11 1E+11ProcessHandleCount Windows Handles 10,000 1,000
ProcessIOBytes (Hard Limit Only) Bytes written to IO Bytes 0 1E+08
ProcessThreadCount Number of Threads in Overall Process Threads 10,000 200
ProcessVirtualBytes (Hard Limit Only) Memory consumed Bytes 0 1E+09
SharePointDatabaseQueryCount SharePoint DB Queries Invoked Number 20 100
SharePointDatabaseQueryTime Amount of time spent waiting for a query to be performed Seconds 120 60
UnhandledExceptionCount Unhanded Exceptions 50 3
UnresponsiveprocessCount We have to kill the process because it has become unresponsive Number 2 1
Sydney 2011
SharePoint 2010 Approach• Developers build
custom solutions• Administrators leverage
resource monitors to check site collection usage
• Site collection owners deploy, activate and implement the customizations
Developer • Design, build and test
customizations
Administrator• Monitor customizations
Site Collection Owner• Activate and use
customizations• Install customizations
Sydney 2011
ON-PREMISE SANDBOXDeveloping in the Sandbox
Sydney 2011
Solution Validation[GuidAttribute("34805697-1FC4-4b66-AF09-AB48AC0F9D97")]public class PublisherValidator : SPSolutionValidator{
[Persisted] List<string> _allowedPublishers;
public override void ValidateSolution( SPSolutionValidationProperties properties){ }
public override void ValidateAssembly( SPSolutionValidationProperties properties, SPSolutionFile assembly){ }}
Sydney 2011
Full trust proxy• Operations in class that inherits
Microsoft.SharePoint.Usercode.SPProxyOperation • Arguments in serializable class that inherits
Microsoft.SharePoint.Usercode.SPProxyOperationArgs
• Register full trust proxy• Recycle user code service• Consume via
SPUtility.ExecuteRegisteredProxyOperation
Sydney 2011
Load BalancingSandboxed solutions can be run in two modes:• Local Mode:– Execute code on WFE– Low administration overhead– Lower scalability
• Remote Mode:– Execute on dedicated SharePoint servers– Load balanced distribution of code execution
requests
Sydney 2011
3 Types
• On-premise sandbox
• SharePoint online• SharePoint online dedicated
Sydney 2011
Limited web services
WebSvcwebpartpages
Provides methods for working with Web Parts.The following methods are not available in SharePoint Online:•AssociateWorkflowMarkup•ExecuteProxyUpdates•GetAssemblyMetaData•GetDataFromDataSourceControl•GetFormCapabilityFromDataSourceControl•RemoveWorkflowAssociation•ValidateWorkflowMarkupAndCreateSupportObjects
WebSvcListsProvides methods for working with SharePoint lists, content types, list items, and files.The following method is not available in SharePoint Online:•AddDiscussionBoardItem
http://msdn.microsoft.com/en-us/library/gg454740.aspx
Sydney 2011
Development Process
Develop/ Debug
local.contoso.com
F5
dev.spo.contoso.com
*.wsp
*.wsp
spo.contoso.com
*.wsp
Upload/ Activate/ Deactivate
Sydney 2011
Getting to data
Sydney 2011
Client-Object Model• New APIs for interacting with SharePoint sites• Supported platforms– .NET 3.5 (and below)– Silverlight 2.0 (and above)– JavaScript/Jscript
• Provides a means to call services outside SharePoint Online
Sydney 2011
Equivalent ObjectsServer (Microsoft.SharePoint)
.NET Managed(Microsoft.SharePoint.Client)
Silverlight(Microsoft.SharePoint.Client.Silverlight)
ECMAScript(SP.js)
SPContext ClientContext ClientContext ClientContext
SPSite Site Site Site
SPWeb Web Web Web
SPList List List List
SPListItem ListItem ListItem ListItem
SPField Field Field Field
Member names mostly the same from server to client (e. g., SPWeb.QuickLaunchEnabled = Web.QuickLaunchEnabled)
Sydney 2011
Architecture/Execution
Client.svc
Server OM
Contentdatabase
ECMAScript OM
Proxy
Managed OM
Proxy
Managed Controls and Logic
ECMAScriptControlsand Logic
XML Request
XML Request
JSON Response
JSON Response
Browser
Managed Client
SharePoint Server
Sydney 2011
SHAREPOINT ONLINEDeveloping in the Sandbox
Sydney 2011
Authentication
Sydney 2011
Authentication • Claims + Federation + Multiple Authentication
Providers• FedAuth cookie with HTTP Only Flag =
WinInet.dll http://msdn.microsoft.com/en-us/library/hh147177.aspx
Thanks for listening!
Remember to submit your feedback so you can go into the raffle draw at the end of the day! And don’t forget that
you have to be at the draw to claim your prizes!
SponsorsGold
Silver
Bronze