client object model - sharepoint extreme 2012
DESCRIPTION
TTRANSCRIPT
Using Client Object Model
Daniel PlockerCTO, Advantech
Agenda
• Client Object Model overview
• ECMA Script Client OM
• Extending SP with HTML 5
• Going Mobile• .Net Managed Client
Why Client OM?
Client side integration between SharePoint and existing Office or LOB apps simplifies day-to-day activities.
Richer, smoother and more intuitive user experience.
Better multi-platform support.
The Basics
Client-side library for remotely calling SharePoint Mirrors (a subset) of objects on the server Usable in JavaScript, .net CLR, Silverlight
CLR
Requests are batched for over- the-wire performance
Used by SharePoint UI for operations like batch deletion
Equivalent Objects
3 things to know
1. ClientContext is the central object
clientContext = new ClientContext(“http://mysite”);
2. Before you read a property, you have to ask for it
clientContext.Load(list);
3. All requests must be committed in a batch
clientContext.ExecuteQuery();
Accessing
Data with
Client OM
Client Application
Client Application
Client OM
JSONExecuteQuery()
XML
WPF//OfficeSilverlightJavaScript
SharePoint Data
SharePoint API
Web Service
ServerApplication
Client.svc
clientserver
Client
Object
Model
Limitations
Client object model cannot be used on server to talk to same-server
You still need to handle synch/update semantics (change log could help)
No elevation of privilege capabilitiesRequests are throttled .net CLR has sync method; Silverlight CLR and Jscript are async
JavaScript Client object model
JavaScript Client OM
JavaScript 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 files with
debug mode
Method signatures can be different compared to .NET and Silverlight
Different data value types
JavaScript Client OM
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
SP.js (SP.debug.js) 380KB (559KB)
SP.Core.js (SP.Core.debug.js) 13KB (20KB)
SP.Runtime.js (SP.Runtime.debug.js) 68KB (108KB)
JavaScript in SharePoint 2010
JavaScript Client OM
Fluent UI
Status Bar
and
Notificatio
n Area
DEMO
Items not covered by CSOM
User ProfilesPeopleSearchEnterprise MetadataExcel REST web servicesPublishingAdministration
HTML 5
<HTML> <CANVAS><VIDEO><INPUT><AUDIO><COMMAND><DATALIST><TIME>
HTML 5 – Getting it Working
<HTML> tag Internet Explorer 9 compatibility <meta http-equiv="X-UA-
Compatible" content="IE=9"/> Potential issues and workarounds
DEMO
Going Mobile with JQuery
jQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of HTML$("div.test").add("p.quote").addClass("blue").slideDown("slow");$.each([1,2,3], function(){ … }jQuery Mobile is a touch-optimized web framework
Going Mobile with SharePoint
Built-in mobile view with &mobile=1You can customize the mobile view and master page.To take advantage of JQuery Mobile:
Create a simple master page, HTML5 valid
Add script linksTo use with client OM, don’t forget ExecuteOrDelayUntilScriptLoaded
DEMO
NET Client object model
.Net CLR Client OM
Provides easy access from remote .NET clients to manipulate SharePoint data
Can be utilized from managed code - also from office clients etc.
Assemblies Microsoft.SharePoint.Client.dll (281kb)
Microsoft.SharePoint.Client.Runtime.dll (145kb)
.Net CLR Client OM
DEMO
Questions?
Summery
Client OM 3 Flavors Batch processing
.Net Managed Client Integration with LoB
ECMAScript Client OM Simplify UI Basis for client-side
programming
HTML5 and Mobile Enable HTML5 Use JQuery
ThankYou!