client object model - sharepoint extreme 2012

29
Using Client Object Model Daniel Plocker CTO, Advantech

Upload: daniel-plocker

Post on 07-Dec-2014

1.229 views

Category:

Technology


1 download

DESCRIPTION

T

TRANSCRIPT

Page 1: Client Object Model - SharePoint Extreme 2012

Using Client Object Model

Daniel PlockerCTO, Advantech

Page 2: Client Object Model - SharePoint Extreme 2012

Agenda

• Client Object Model overview

• ECMA Script Client OM

• Extending SP with HTML 5

• Going Mobile• .Net Managed Client

Page 3: Client Object Model - SharePoint Extreme 2012

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.

Page 4: Client Object Model - SharePoint Extreme 2012

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

Page 5: Client Object Model - SharePoint Extreme 2012

Equivalent Objects

Page 6: Client Object Model - SharePoint Extreme 2012

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();

Page 7: Client Object Model - SharePoint Extreme 2012

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

Page 8: Client Object Model - SharePoint Extreme 2012

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

Page 9: Client Object Model - SharePoint Extreme 2012

JavaScript Client object model

Page 10: Client Object Model - SharePoint Extreme 2012

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

Page 11: Client Object Model - SharePoint Extreme 2012

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)

Page 12: Client Object Model - SharePoint Extreme 2012

JavaScript in SharePoint 2010

Page 13: Client Object Model - SharePoint Extreme 2012

JavaScript Client OM

Page 14: Client Object Model - SharePoint Extreme 2012

Fluent UI

Status Bar

and

Notificatio

n Area

Page 15: Client Object Model - SharePoint Extreme 2012

DEMO

Page 16: Client Object Model - SharePoint Extreme 2012

Items not covered by CSOM

User ProfilesPeopleSearchEnterprise MetadataExcel REST web servicesPublishingAdministration

Page 17: Client Object Model - SharePoint Extreme 2012

HTML 5

<HTML> <CANVAS><VIDEO><INPUT><AUDIO><COMMAND><DATALIST><TIME>

Page 18: Client Object Model - SharePoint Extreme 2012

HTML 5 – Getting it Working

<HTML> tag Internet Explorer 9 compatibility <meta http-equiv="X-UA-

Compatible" content="IE=9"/> Potential issues and workarounds

Page 19: Client Object Model - SharePoint Extreme 2012

DEMO

Page 20: Client Object Model - SharePoint Extreme 2012

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

Page 21: Client Object Model - SharePoint Extreme 2012

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

Page 22: Client Object Model - SharePoint Extreme 2012

DEMO

Page 23: Client Object Model - SharePoint Extreme 2012

NET Client object model

Page 24: Client Object Model - SharePoint Extreme 2012

.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)

Page 25: Client Object Model - SharePoint Extreme 2012

.Net CLR Client OM

Page 26: Client Object Model - SharePoint Extreme 2012

DEMO

Page 27: Client Object Model - SharePoint Extreme 2012

Questions?

Page 28: Client Object Model - SharePoint Extreme 2012

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

Page 29: Client Object Model - SharePoint Extreme 2012

ThankYou!