160 likes | 549 Vues
Agenda. What is the Client Object ModelSupported environmentsArchitectureHow to use itSharePoint contextAccessing objectsEfficient queriesAdd/Update/Delete. About Me. Been involved in Software Development over 15 yearsMaster of Information SystemsMultiple Microsoft certifications
E N D
1. Mark Nischalke, MCPD, MCSD, MCAD
SharePoint Architect
Prequel Solutions SharePoint 2010 Client Object Model Overview & Capabilities
2. Agenda What is the Client Object Model
Supported environments
Architecture
How to use it
SharePoint context
Accessing objects
Efficient queries
Add/Update/Delete
3. About Me Been involved in Software Development over 15 years
Master of Information Systems
Multiple Microsoft certifications
Frequent contributor and MVP for Code Project
4. Web Services Web services are available for use
_vit_bin/Lists.asmx
_vit_bin/Sites.asmx
_vit_bin/Webs.asmx
REST interface
_vti_bin/ListData.svc
_vti_bin/ListData.svc/Employees(4)
_vti_bin/ListData.svc/Employees?$orderby=Name
5. Client Object Model Supported environments
.NET managed code (.NET Framework 3.5 only)
JavaScript
Silverlight
7. Client Object Model _vti_bin/Client.svc/ProcessQuery
Receives XML
Returns JSON
8. Reference assemblies .NET managed code (<%SharePoint Root%>\ISAPI)
Microsoft.SharePoint.Client.dll (282kb)
Microsoft.SharePoint.Client.Runtime.dll (146kb)
JavaScript
SP.js (381kb)
* SP.Runtime.js (67kb)
Silverlight (<%SharePoint Root%>\TEMPLATE\LAYOUTS\ClientBin)
Microsoft.SharePoint.Client.Silverlight.dll (266kb)
Microsoft.SharePoint.Client.Runtime.Silverlight.dll (142kb)
Microsoft.SharePoint.dll 15.9 MBMicrosoft.SharePoint.dll 15.9 MB
9. Client Object Model Most server objects are represented in the Client OM
10. Client Object Model Authentication
Uses Windows Authentication by default
Can be configured for Claims Based Authentication
ctx.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication; ctx.FormsAuthenticationLoginInfo = new FormsAuthenticationLoginInfo("loginName", "password");
11. Client Object Model ClientContext ctx = new ClientContext(http://mysite);
Web web = ctx.Site.RootWeb;
ctx.Load(web);
ctx.Load(web, w => w.Title, w => w.Description);
ctx.Load(web, w => w.Title,
w => w.Lists .Include(l => l.Fields
.Include(f => f.InternalName,
f => f.Group)));
12. Client Object Model ClientContext ctx = new ClientContext(http://mysite);
Web web = ctx.Site.RootWeb;
var lists = ctx.LoadQuery(web.Lists);
var lists = ctx.LoadQuery(web.Lists.Include(l => l.Title));
var query = from l in web.Lists
.Include(l => l.Title)
select l;
var lists = ctx.LoadQuery(query);
13. Demo
14. Download and References http://www.codeproject.com/KB/sharepoint/CSOM_Part1.aspx
http://www.codeproject.com/KB/sharepoint/CSOM_Part2.aspx
http://www.mansoftdev.com
mark@mansoftdev.com
15. Q & A