Dec 05, 2014
LECTURE
Building SharePoint Online Web PartsToni Frankola
SharePoint MVPAcceleratio d.o.o.
Contents
• Office365 / SharePoint Online• Developing for SharePoint Online• Demos and tips• Some advanced stuff
office365
SharePoint• Sharing documents• Corporate social networks• Managing projects and documents• Search• News• Permissions• Offline sync• IM• …
Challange
• Case study:– Customer wants to use SharePoint in the
cloud• …but with special forms, custom
permissions and custom web parts
The solution
SandBoxed Solutions
• Isolated SP process (User Code Service)
• SubsetMicrosoft.SharePoint namespace
• Managed via browser (Solutions gallery)
Hello World!
SharePoint Sandboxed solution
DEMO
SANDBOXED SOLUTIONS
- for developers
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
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
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
SharePoint Features / Solutions
Solution (.wsp)
Feature 2
… Event Handler CSS Web
Part
Feature 1
… JS Web Part
Developer Tools
• Visual Studio 2010 SharePoint Power Tools– adds Visual Web Part– SandBoxed solution validation (must have!)
• Office365 Sandbox FxCop rules
• CKSDEV add-on– Trusted proxy– Deployment options
• Other stuff:– Visual Studio 2010 Productivity Pack– SP Dispose Checker (how to integrate with VS)
SharePoint UX
• Users want different UX
UX: What do we need?
• ASP.NET– .master page– CSS– javascript
SharePoint Metro UI
Demo
SharePoint UX (2)
Link buttons
• jQuery link buttons
• SharePoint lista za linkove– Security– UI–…
• SharePoint Feature
SharePoint Link Buttons
Demo
Monitoring Sandbox
Very bad WebPart
• Infinite loop example:
• Farm solution = problem• Sandboxed solution:
Monitoring 101
• Site Collection Admin
• Farm admin
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
Extending Sandbox
Not supported!
• Off-box connections, http, web services, etc
• ADO.net• Enterprise features (Search, BCS, etc.)• Threading• P-Invoke• IO• Other sites (site collections)
Beyond Limits
• No 3rd party .NET components – Revert back to JQuery• JQuery charts (licensing!)
– Silverlight!
Extending Sandbox
• Trusted proxies:
Worker Service(SPUCWorkerProcess.exe)
SPUtility
SPProxyOperationArgs
GAC
SPProxyOperation
SPProxyOperationArgs
Untrusted Code
SecuredResource
SharePoint Client object model
• Supported technologies– .NET– Silverlight– ECMAScript
(JavaScript, JScript)
„Search as you type” demo
PITANJA
HVALA!