Anda di halaman 1dari 20

Building Dynamic Applications

with the SharePoint Client Object


Model
Eric Shupps
SharePoint Server MVP
About Me
SharePoint Server MVP
President, BinaryWave
Microsoft Patterns & Practices (spg.codeplex.com)
CKS:DEV (cksdev.codeplex.com)
Web: www.binarywave.com
Blog: www.sharepointcowboy.com
Twitter: @eshupps
Facebook: www.facebook.com/sharepointcowboy
Agenda
Introduction to the Client Object Model
.NET Client Object Model
Silverlight and Client Object Model
JavaScript and Client Object Model
Demos
Building .NET, Silverlight, Javascript and WPF Client Applications
with SharePoint Data
This session is a hunky dory jolly good
awesomeness thingy
- Tobias Zimmergren
Legacy Data Access
SharePoint Data
SharePoint API
Web Service
Client Application
Server
Application
Client Object Model
.Net CLR Silverlight JavaScript
Client Application
Accessing Data with Client OM
Content
Database
Server
Object
Model
Client
Service
JavaScript Controls
JavaScript OM
Proxy
Managed Controls
Proxy
Managed OM
Browser
Client Server
Equivalent Objects
Server
(Microsoft
.SharePoint)
.NET Managed
(Microsoft.SharePoint
.Client)
Silverlight
(Microsoft.SharePoint
.Client.Silverlight)
JavaScript
(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
Getting Started: 3 things to know
ClientContext is the central object


Before you read a property, you have to ask for it


All requests must be committed in a batch


clientContext.ExecuteQuery();
clientContext.Load(list);
clientContext =
new ClientContext(http://mysite);
High level handling of commands
XML
JSON
Execute commands
in the batch:
Client.svc
Sequence of
commands:
context.ExecuteQuery();
command 1;
command 2;
command 3;
Send results back
command 1;
command 2;
command 3;
Process results
Server Client Application
Client Object Model Limitations
You must handle synch/update semantics in
code
No elevation of privilege capabilities
Requests are throttled
.net CLR has sync method;
Silverlight CLR and Jscript are async
Limited subset of Server OM functionality
You only get what you ask for nothing more
(but sometimes less)
.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)
To Compare: Microsoft.SharePoint.dll
15.3MB


DEMO
Building a .NET Client OM Application
Using SharePoint Data
Silverlight in SharePoint 2010
Native Silverlight web part allows for compilation
and deployment of XAP-only solutions
One-click deployment from Visual Studio 2010
Web Parts can contain custom properties that
are sent to Silverlight via the InitParams property
Abstracted visual design in Expression (make
the designer do it!)

Silverlight CLR Client OM
Use the correct references:
C:\Program Files\Common Files\Microsoft
Shared\Web Server Extensions
\14\TEMPLATE\LAYOUTS\ClientBin
Microsoft.SharePoint.Client.Silverlight
262KB
Microsoft.SharePoint.Client.Silverlight.R
untime
138KB
Silverlight Client OM

Building and Deploying Silverlight
Built in support in Visual Studio 2010
Redirect assembly output into Module
F5 deploy and debug experience
SharePoint WSP
Module
Visual Studio
builds WSP
package on
F5
XAP
DEMO
Building a Silverlight Client OM Application
Using SharePoint Data
JavaScript Client OM
Provides similar functionality to .NET/Silverlight COM from
JavaScript/ECMAScript
Identical structure
Initialize Context -> Specify Items -> Load Objects ->
Execute Query
Limited to current site context (no cross-site scripting)
Asynchronous (like Silverlight)
Be aware of syntax changes
get_web()
get_lists()
get_item()

DEMO
Building a Javascript Client OM Application
Using SharePoint Data
Your Feedback is Important
Please fill out a session evaluation form.

Thank you!

Anda mungkin juga menyukai