Upload
elaine-van-bergen
View
1.565
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Presentation delivered at SharePoint saturday brisbane on sandboxed solutions, CSOM, exchange API and authentication with 365
Citation preview
SharePoint SaturdaySponsorsGold
Silver
Bronze
Programming SharePoint and Office 365
on the Client Side
Elaine van BergenOBS
SharePoint Saturday Brisbane 2012
Topics• Sandboxed Solutions• Client Object Models• Exchange Office 365 API• Authentication
SharePoint Saturday Brisbane 2012
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
SharePoint Saturday Brisbane 2012
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
SharePoint Saturday Brisbane 2012
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
SharePoint Saturday Brisbane 2012
Unsupported Features
• Anything above the site collection• Access to External Code/Data• Creation of SPWeb/SPSite outside of context• SPSecurity• BCS (WCF service supported)
SharePoint Saturday Brisbane 2012
Sandbox Deployment
Upload
Activation
DeactivationDeletion
Upgrade
SharePoint Saturday Brisbane 2012
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
SharePoint Saturday Brisbane 2012
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
SharePoint Saturday Brisbane 2012
SANDBOXED SOLUTIONDEMO
SharePoint Saturday Brisbane 2012
Sandboxed Solution Summary• Easy Deployment Model – No coffee break• Limited functionality
SharePoint Saturday Brisbane 2012
Why Client Object Model?• More SharePoint Web services
is a major request• Client Object Model provides more complete API
instead of more services• Provides an abstraction layer to return results as
recognizable SharePoint objects• Consistent developer experience across platforms
(.NET, ECMAScript, Silverlight)
SharePoint Saturday Brisbane 2012
Supported Areas
• Site Collections and Sites• Lists, List Items, Views, and List Schemas• Files and Folders• Web, List, and List Item Property Bags• Web Parts• Security• Content Types• Site Templates and Site Collection Operations
SharePoint Saturday Brisbane 2012
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
SharePoint Saturday Brisbane 2012
Server (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
SharePoint Saturday Brisbane 2012
.Net Client OM• Designed for use outside of SharePoint• Can be used with .Net 4.0 • Microsoft.SharePoint.Client
.Net ExampleClientContext clientContext = new ClientContext("http://server");
//Load methodclientContext.Load(clientContext.Web); clientContext.Load(clientContext.Web.Lists);
//LoadQuery methodvar q1 = from list in context.Web.Lists where list.Title != null select list; var r1 = context.LoadQuery(q1);
SharePoint Saturday Brisbane 2012
ECMAScript Client OM• ECMAScript Client OM is easily added to a
SharePoint ASPX page - reference:– _layouts/sp.js– Add this using <SharePoint:ScriptLink>
• All libraries crunched for performance– Use un-crunched *.debug.js by adding
<SharePoint:ScriptLink … ScriptMode=“Debug” />
• Method signatures can be different• Different data value types
SharePoint Saturday Brisbane 2012
Silverlight Client OM
• Silverlight Development Enabled by Client OM
• Can use Silverlight in separate ASPX page or in Web Part
• Can utilize Client OM in Silverlight to create SharePoint apps
SharePoint Saturday Brisbane 2012
Creating Silverlight Web Parts
• A Web Part can be a host for Silverlight• SharePoint ships with Silverlight web part• The web part can contain custom properties
that are sent to Silverlight via the InitParameters property
• The XAP file can be deployed to LAYOUTS and loaded at run time
• The Silverlight application can then make use of the Client OM.
SharePoint Saturday Brisbane 2012
JAVASCRIPT CLIENT OBJECT MODELDEMO
SharePoint Saturday Brisbane 2012
Client Object Model Summary
• 3 different versions• Need to load items to get data• Far easier than web services to get data
SharePoint Saturday Brisbane 2012
EXCHANGE INTEGRATION
SharePoint Saturday Brisbane 2012
EWS MA 1.1 Overview
• Managed API for developing applications that use Exchange Web Services
• Functional parity with EWS*• Makes EWS calls under the covers• Backwards compatible– Request versioning
new ExchangeService(ExchangeVersion.Exchange2010_SP1);
• Cloud compatible out of the box
SharePoint Saturday Brisbane 2012
Autodiscover
• Don’t hardcode EWS URL in your app!• Use Autodiscover to find most efficient Client
Access Server URL for a given mailbox– On-Premise• Global & distributed deployments
– Cloud based• Office 365• Outlook Live• Live@EDU
SharePoint Saturday Brisbane 2012
Autodiscover – Exchange Online
EXO Office 365
EWS MAApplication
EWS MA client contacts Autodiscoversevice
Autodiscover service returns URL for EWS
bindings
EWS MA client connects to Exchange Web Services
Firewall
EWS MA client executes callback to Validate URL
Redirection
SharePoint Saturday Brisbane 2012
Impersonation
• Application performs actions using another user’s– Identity– Permissions
• Exchange ApplicationImpersonation role needs to be granted to a user
• Service account is typically allowed to impersonate other accounts
SharePoint Saturday Brisbane 2012
OFFICE CLIENT/EXCHANGE DEMODEMO
SharePoint Saturday Brisbane 2012
Office Client/Exchange Summary
• Easy to program against exchange• Hybrid solutions to solve business problems• Call SharePoint from business systems
SharePoint Saturday Brisbane 2012
SharePoint Saturday Brisbane 2012
Authentication
• Claims + Federation + Multiple Authentication Providers• FedAuth cookie with HTTP Only Flag = WinInet.dll • Active vs. Passive
COMPLICATED !
http://msdn.microsoft.com/en-us/library/hh147177.aspx http://www.wictorwilen.se/Post/How-to-do-active-authentication-to-Office-365-and-SharePoint-Online.aspx
SharePoint Saturday Brisbane 2012
Topics• Sandboxed Solutions• Client Object Models• Exchange Office 365 API• Authentication
SharePoint Saturday Brisbane 2012
QUESTION AND ANSWER@LANEYVB
SharePoint Saturday
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