33

Intro to SharePoint Sandboxed Solutions

Embed Size (px)

DESCRIPTION

Sandboxed Solutions are the development paradigm for SharePoint Online. In this session, you’ll learn about sandboxed solutions including how to develop, debug and deploy solutions. You’ll also learn the breadth of solutions that can be developed in the sandbox and strategies for developing common scenarios that are not enabled in the sandbox. We are going to discuss tools that can help us develop solutions in a sandbox and tricks that can assist us to streamline code development and application life cycle. The session will be accompanied with series of demoes that are going to show some of best and worst practices with SharePoint solutions.

Citation preview

Page 1: Intro to SharePoint Sandboxed Solutions
Page 2: Intro to SharePoint Sandboxed Solutions

LECTURE

Building SharePoint Online Web PartsToni Frankola

SharePoint MVPAcceleratio d.o.o.

Page 3: Intro to SharePoint Sandboxed Solutions

Contents

• Office365 / SharePoint Online• Developing for SharePoint Online• Demos and tips• Some advanced stuff

Page 4: Intro to SharePoint Sandboxed Solutions

office365

Page 5: Intro to SharePoint Sandboxed Solutions

SharePoint• Sharing documents• Corporate social networks• Managing projects and documents• Search• News• Permissions• Offline sync• IM• …

Page 6: Intro to SharePoint Sandboxed Solutions

Challange

• Case study:– Customer wants to use SharePoint in the

cloud• …but with special forms, custom

permissions and custom web parts

Page 7: Intro to SharePoint Sandboxed Solutions

The solution

Page 8: Intro to SharePoint Sandboxed Solutions

SandBoxed Solutions

• Isolated SP process (User Code Service)

• SubsetMicrosoft.SharePoint namespace

• Managed via browser (Solutions gallery)

Page 9: Intro to SharePoint Sandboxed Solutions

Hello World!

SharePoint Sandboxed solution

DEMO

Page 10: Intro to SharePoint Sandboxed Solutions

SANDBOXED SOLUTIONS

- for developers

Page 11: Intro to SharePoint Sandboxed Solutions

Request Flow

Worker Service(SPUCWorkerProcess.exe)

Full Object Model

Host Services (SPUCHostService.exe)

Execution Manager(Inside Application Pool)

Subset Object Model

Untrusted Code

IIS(WPW3.EXE)

FRONT END BACK END

Subset-Model RequestFull-Model

Request

Page 12: Intro to SharePoint Sandboxed Solutions

Supported in Sandboxed Solutions

• Web Parts (no Visual WPs)• Lists• List Templates• Custom Actions• Workflows• Event Receivers• Content Types• Site Columns• …

Source: http://msdn.microsoft.com/en-us/library/ff872402.aspx

Page 13: Intro to SharePoint Sandboxed Solutions

Supported API• All of the Microsoft.SharePoint namespace, except:

– SPSite constructor– SPSecurity object– SPWorkItem and SPWorkItemCollection objects– SPAlertCollection.Add method– SPAlertTemplateCollection.Add method– SPUserSolution and SPUserSolutionCollection objects– SPTransformUtilities object– Microsoft.SharePoint.Navigation namespace

• All of the Microsoft.SharePoint.Utilities namespace, except– SPUtility.SendEmail method– SPUtility.GetNTFullNameandEmailFromLogin method– Microsoft.SharePoint.Workflow namespace

• All of the Microsoft.SharePoint.WebPartPages namespace, except– SPWebPartManager object– SPWebPartConnection object– WebPartZone object– WebPartPage object– ToolPane object– ToolPart object

Source: http://msdn.microsoft.com/en-us/library/ff872402.aspx

Page 14: Intro to SharePoint Sandboxed Solutions

SharePoint Features / Solutions

Solution (.wsp)

Feature 2

… Event Handler CSS Web

Part

Feature 1

… JS Web Part

Page 16: Intro to SharePoint Sandboxed Solutions

SharePoint UX

• Users want different UX

Page 17: Intro to SharePoint Sandboxed Solutions

UX: What do we need?

• ASP.NET– .master page– CSS– javascript

Page 18: Intro to SharePoint Sandboxed Solutions

SharePoint Metro UI

Demo

Page 19: Intro to SharePoint Sandboxed Solutions

SharePoint UX (2)

Page 20: Intro to SharePoint Sandboxed Solutions

Link buttons

• jQuery link buttons

• SharePoint lista za linkove– Security– UI–…

• SharePoint Feature

Page 21: Intro to SharePoint Sandboxed Solutions

SharePoint Link Buttons

Demo

Page 22: Intro to SharePoint Sandboxed Solutions

Monitoring Sandbox

Page 23: Intro to SharePoint Sandboxed Solutions

Very bad WebPart

• Infinite loop example:

• Farm solution = problem• Sandboxed solution:

Page 24: Intro to SharePoint Sandboxed Solutions

Monitoring 101

• Site Collection Admin

• Farm admin

Page 25: Intro to SharePoint Sandboxed Solutions

Monitored ResourcesMetric Name Description Units Resources

Per PointHard Limit

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 in Percentage 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

Page 26: Intro to SharePoint Sandboxed Solutions

Extending Sandbox

Page 27: Intro to SharePoint Sandboxed Solutions

Not supported!

• Off-box connections, http, web services, etc

• ADO.net• Enterprise features (Search, BCS, etc.)• Threading• P-Invoke• IO• Other sites (site collections)

Page 28: Intro to SharePoint Sandboxed Solutions

Beyond Limits

• No 3rd party .NET components – Revert back to JQuery• JQuery charts (licensing!)

– Silverlight!

Page 29: Intro to SharePoint Sandboxed Solutions

Extending Sandbox

• Trusted proxies:

Worker Service(SPUCWorkerProcess.exe)

SPUtility

SPProxyOperationArgs

GAC

SPProxyOperation

SPProxyOperationArgs

Untrusted Code

SecuredResource

Page 30: Intro to SharePoint Sandboxed Solutions

SharePoint Client object model

• Supported technologies– .NET– Silverlight– ECMAScript

(JavaScript, JScript)

Page 31: Intro to SharePoint Sandboxed Solutions

„Search as you type” demo

Page 32: Intro to SharePoint Sandboxed Solutions

PITANJA

Page 33: Intro to SharePoint Sandboxed Solutions

HVALA!