sharepoint 2010 client side object model. agenda introduction the problem client side vs server side...
Post on 28-Mar-2015
218 Views
Preview:
TRANSCRIPT
SharePoint 2010 Client Side Object Model
Agenda• Introduction
• The Problem
• Client side vs Server Side
• Client Side Object Model– How it works– What can it do?– Limitations– Possibilities
• REST Interface
• Demonstration – REST + CSOM
• Questions
Introductions
• Who am I?
• Who are you?
• “Customisation Possibilities”
The Problem
• SharePoint does so much!
• But not exactly what I want
• I know – I’ll customise it!
The Problem
• Custom development – Too Risky ?
• Data issues?
– Too Expensive ?• Initial development• Maintenance• Upgrade?
• More often than not, custom development requires installation of components on the Server– Promotion through environments– Time and costs associated with downtime
The Problem
Customise!
The Problem
$@#%$*&!
The Problem
• A lot of organisations simply don't allow server side coding
• A lot of hosting situations don’t allow server side coding– BPOS / Office 360 / SharePoint Online– Web Central– Shared Tenancy / Security Issues
• Team based SharePoint development rarely performed– TFS– Proper Build Servers
Client side vs Server Side
Client side
Server Side
Client side vs Server SideClient Side
• Code running on client computer
• Can only interact with SharePoint via web services
• Hard to do anything of any complexity
Server Side
• Code running on server
• Can use SharePoint object model directly
• Requires installation on server
Client side vs Server SideDesigner *Server Side
Web Part DevelopmentGeneric Feature DevelopmentUI Menu Feature DevelopmentSharePoint Event Handlers Custom Web ServicesCustom Field TypesCustom Page Development / Code behind Custom Windows Applications / Utilities
Custom STSADM commandsBusiness Connectivity Services (BCS)(2010)
InfoPath FormsCustom Timer JobsCustom Workflows / Custom Workflow Actions
Branding / DesignUser controlsWorkflowsAdvanced configuration…
Client side vs Server Side
Client Side
?
• So previously the ‘real’ client side options were:– Web Services
• Very low level• A bit complex (security)
– Scripts on page• Mainly for UI change (hiding fields, UI improvements)• “Can call web services” – yuck• VB can do some interesting things
– SharePoint designer modifications• OK – if you don’t delete everything• Customisations not as portable as would like• Know your boundaries!
Client side vs Server Side
• Some client side work-arounds got quite popular:
– JPoint – series of JavaScript functionality in web parts
– HTML Calculated column –using the ‘calculated column’ to conditionally output HTML
– JavaScript web-service libraries – still yuck
Client side vs Server Side
• SharePoint 2010 has two major areas of functionality in this area1. Client Side Object Model (CSOM)
2. REST Services
What’s New Already?!
16
What does the client object model enable?
• Abstraction layer• Results returned as recognizable SharePoint objects
Provide powerful ways to interact with SharePoint Online data remotely without web services – providing access to objects at the site-collection level and lower within the SharePoint hierarchy.
• .NET• ECMAScript• Silverlight
Consistent developer experience across platforms
Client Side Object Model
Client Side Object Model
• In a nutshell - the client side object model provides an ‘object model’ to client technologies– .Net Applications– Silverlight– JavaScript (ECMAScript)
• Each of these have a separate .dll to work with, but have very similar code
Client Side Object Model
• Each of these have work with the Client web-service under the hood to provide the functionality on the server
CSOM
Client Side Object Model
Client Side Object Model
• Example - Delete List ( .net ):
Client Side Object Model
• Example - Delete List ( JavaScript ):
Client Side Object Model
Demo – CSOM
Client Side Object Model
• JavaScript?– Yes – JavaScript– SharePoint 2010 Ribbon– Custom Links– Content Editor Web Parts– Added into Forms pages for lists and libraries– Scriptlets
Client Side Object Model
Demo – JS
Client Side Object Model
• Security– Windows Credentials by Default– Can use Forms Authentication
– Permission level setting
Client Side Object ModelTips and Tricks?
– Minimise what you need to retrieve
– Know what is loaded in context and what isn’t… – Beware of IQueryable with ListItem– JavaScript only has a-sync calls…. Ouch– Use the JavaScript “Item Table”
• Holds data for the current item context
Summary
• Before– Client side coding was very difficult– Either via web services or very limited in functionality
• After– Client side coding much easier– “Object Model” - like coding on the server– Similar for JavaScript, Silverlight, .Net Applications– Don’t need to develop on the server!– New Possibilities with Rest and the CSOM
Reading:
Using the SharePoint Foundation 2010 Managed Client Object Modelhttp://msdn.microsoft.com/en-us/library/ee857094.aspx
Managed Client Object Modelhttp://msdn.microsoft.com/en-us/library/ee537247.aspx
Common Programming Taskshttp://msdn.microsoft.com/en-us/library/ee537013.aspx
Praveen Battulahttp://praveenbattula.blogspot.com/
Questions?
top related