SlideShare a Scribd company logo
How the Client Object
Model Saved the Day!
Liam Cleary
Solution Architect | SharePoint MVP
About Me
•   Solution Architect @ SusQtech (Winchester, VA)
•   SharePoint MVP since 2007
•   Working with SharePoint since 2002
•   Worked on all kinds of projects
    •   Internet
    •   Intranet
    •   Extranet
    •   Anything SharePoint Really
• Involved in Architecture, Deployment, Customization and
  Development of SharePoint
It is a wise man who knows
where courage ends and
stupidity begins.
Jerome Cady – Hollywood Screenwriter
SharePoint Saturday The Conference DC - How the client object model saved the day
Agenda
• Data Access In SharePoint
  • SharePoint 2007
  • SharePoint 2010
• What is the Client Object Model?
  • Managed Code
  • Silverlight
  • ECMAScript
• How can we use it?
• How did it save the day?

• NOTE: Not a heavy code session, well we will see!!
Data Access In SharePoint 2007
• Historically we were tied to direct API or Web Services

       SharePoint Database


          SharePoint API         Server Applications


          Web Services
        (Native / Custom)




        Client Applications
Problems
• Out of the box Web Services may not have the required
  methods
• Custom Web Services can be very complicated to create
• API is not rich enough
  • Custom API wrappers are created
  • Seen this again and again
• Complicated to all from JavaScript / jQuery
• Client Applications if developed are all custom, even data
  access
• Applications are not really developed
• See the same issues with every client
Data Access In SharePoint 2010
• Updated for SharePoint 2010
  • Similar Approach with a few tweaks

               SharePoint Database


                  SharePoint API


     Web Services
                           Client Object Model
   (Native / Custom)




   Client Applications      Server Applications
What is the Client Object Model?
•   “Knight in Shining Armor” for client application development
•   Simple and easy to use API
•   Consistent implementations
•   Abstracted methods from core API
    • Subset of the Types and Members from Microsoft.SharePoint
      namespace
• Three flavors
    • .NET CLR
    • Silverlight
    • ECMAScript (JavaScript, Jscript)
• Easy to Consume data from SharePoint
Client Object Model
   Browser Based
      ECMA Script
      (JavaScript)

  ECMA Script Object
       Model
                                            SharePoint Server
                                              Object Model
          Proxy

                          Client Services
         Client

          Proxy                                SQL Server
                                                Content
                                               Databases
 Managed Object Model


     .NET Managed
   (.NET & Silverlight)
Client Object Model – Process
• Data is retrieved in a specific way

     Client Application                      Server


        Commands                            Client.svc



                             XML
  context.ExecuteQuery();                  Commands



                               JSON
      Process Results                   Send Back Results
Client Object Model - Objects
   • Similar to core API
         • Naming slightly changed
         • Consistent across all implementations

Server                   .NET Managed                    Silverlight                                  JavaScript
(Microsoft.SharePoint)   (Microsoft.SharePoint.Client)   (Microsoft.SharePoint.Cliernt.Silverlight)   (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
Client Object Model – Getting Started
• No ClientContext = No Connection
clientContext = new ClientContext(“http://mysharepointsite.com”);


• Need to LOAD before you can READ
clientContext.Load(web);
clientContext.Load(web.Lists);

• Must COMMIT requests in a BATCH
clientContext.ExecuteQuery();
clientContext.ExecuteQueryAsync(succeedcallback, failurecallback);
Client Object Model – Object Identities
• Used to batch up objects that can be used before the
  “ExecuteQuery”
ClientContext clientContext = new ClientContext(“http://siteurl”);
List list = clientContext.Web.Lists.GetByTitle(“ListName”);
CamlQuery camlQuery = new camlQuery();
camlQuery.ViewXml = “<View/>”;
ListItemCollection listItems = list.GetItem(camlQuery);
clientContext.Load(list);
clientContext.Load(listItems);
clientContext.ExecuteQuery();

• Once the objects have been set and executed they can be
  iterated through
foreach(ListItem listItem in listItems)
          Console.WriteLine(“Title: ,1-”, listItem*“Title”+,
Client Object Model – Lambda Expressions
• Used trim results, filter or even increase performance
 Trimming
 ClientContext clientContext = new ClientContext("http://siteurl");
 Web site = clientContext.Web;
 clientContext.Load(site,
                s => s.Title,
                s => s.Description);
 clientContext.ExecuteQuery();

 Filter
 ClientContext clientContext = new ClientContext("http://siteurl");
 ListCollection listCollection = clientContext.Web.Lists;
 IEnumerable<List> hiddenLists = clientContext.LoadQuery(
                 listCollection . Where(list => !list.Hidden &&
                 list.BaseType == BaseType.DocumentLibrary)); clientContext.ExecuteQuery();

 Performance
 ClientContext clientContext = new ClientContext("http://siteurl"); IEnumerable<List> lists =
 clientContext.LoadQuery( clientContext.Web.Lists.Include(
                list => list.Title,
                list => list.Hidden,
                list => list.Fields.Include(
                                   field => field.Title,
                                   field => field.Hidden))); clientContext.ExecuteQuery();
Client Object Model – Asynchronous Processing
• Ability to invoke intensive queries Asynchronously
 delegate void AsynchronousDelegate();

 Public void Run()
 {
        ClientContext clientContext = new ClientContext("http://siteurl");
        ListCollection lists = clientContext.Web.Lists;
        IEnumerable<List> newListCollection = clientContext.LoadQuery(
               lists.Include(
                              list => list.Title));

       AsynchronousDelegate executeQueryAsynchronously = new
       AsynchronousDelegate(clientContext.ExecuteQuery);

       executeQueryAsynchronously.BeginInvoke(
             arg =>
             {
                       clientContext.ExecuteQuery();
                       foreach (List list in newListCollection)
                                     Console.WriteLine("Title: {0}", list.Title);
             }, null);
 }
Client Object Model - .NET
• Provides easy access from remote .NET Clients to SharePoint
  Data
• Can be used from Managed Code such as Office
• Utilizes the following Assemblies
  • Microsoft.SharePoint.Client.dll (281 KB)
  • Microsoft.SharePoint.Client.Runtime.dll (145 KB)
• Compared to Microsoft.SharePoint.dll (15.3 MB)
• SQL Like
• Batch Processing
Client Object Model – Managed Code

DEMO
Client Object Model - Silverlight
• Use Silverlight on page or in a web part
• Web Part can contain custom properties by using the “InitParams”
  property
• XAP file deployed to Layouts or Content Database
• Once the Silverlight is loaded it can access the Client Object Model
• Stored in the “14TEMPLATELAYOUTSClientBin” directory
• Utilizes the following Assemblies
  • Microsoft.SharePoint.Client.Silverlight.dll (262 KB)
  • Microsoft.SharePoint.Client.Silverlight.Runtime.dll (138 KB)
• Must call “clientContext.ExecuteQueryAsync”
Client Object Model – Silverlight (WPF)

DEMO
Client Object Model - ECMAScript
• Page needs to load the “SP.js”
  • Use <SharePoint:ScriptLink>
• Can use debug version
   • Use <SharePoint:ScriptLink …ScriptMode=“Debug”>
• Client Context can be set using
 var clientContext = new SP.ClientContext.get_current();
 Or
 var clientContext = new SP.ClientContext();

• SAVE TIME NOTE: Properties are case sensitive
• SP.js (381 KB), SP.Debug.js (561 KB)
Client Object Model – ECMAScript

DEMO
Client Object Model – Wrap-up
• .NET CLR has a Sync Method whereas Silverlight CLR and
  JavaScript are Asynchronous
• All requests are throttled, so be aware of performance
• No ELEVATION of privilege capabilities
  • SPSecurity.RunWithElevatedPrivileges
• Must handle the Synchronize and Update logic
• Need to handle the efficient loading etc. of objects
  • Use LINQ
  • Use Lambda Expressions
• Works well however an element of developer experience is
  needed to use
Client Object Model – How did it save the day?

• Quickly update multiple items on SharePoint
  • No direct Server Access
  • Using Forms Login also
• Add “cool” functionality easily using ECMA Script
  • Inline editing
• Able to track my wife's spending via SharePoint
  • Used Client Object Model to remotely check SharePoint list for
    expenditure and alert on desktop


• Completely made up, but the reality is that simple, this could
  be done, as long as the data feed is available this is achievable
Thank You
•   Personal Email: liamcleary@msn.com
•   Work: http://www.susqtech.com
•   Twitter: @helloitsliam
•   Blog: www.helloitsliam.com

More Related Content

What's hot (20)

External collaboration with Azure B2B
External collaboration with Azure B2BExternal collaboration with Azure B2B
External collaboration with Azure B2B
Sjoukje Zaal
 
SharePoint Saturday Austin - Share point authentication and authorization
SharePoint Saturday Austin - Share point authentication and authorizationSharePoint Saturday Austin - Share point authentication and authorization
SharePoint Saturday Austin - Share point authentication and authorization
Liam Cleary [MVP]
 
What‘s new in Office 365
What‘s new in Office 365What‘s new in Office 365
What‘s new in Office 365
SPC Adriatics
 
Portal and Intranets
Portal and Intranets Portal and Intranets
Portal and Intranets
Redar Ismail
 
WSO2Con USA 2017: Building a Secure Enterprise
WSO2Con USA 2017: Building a Secure EnterpriseWSO2Con USA 2017: Building a Secure Enterprise
WSO2Con USA 2017: Building a Secure Enterprise
WSO2
 
Understanding SharePoint Apps, authentication and authorization infrastructur...
Understanding SharePoint Apps, authentication and authorization infrastructur...Understanding SharePoint Apps, authentication and authorization infrastructur...
Understanding SharePoint Apps, authentication and authorization infrastructur...
SPC Adriatics
 
Social Login
Social LoginSocial Login
Social Login
Michele Leroux Bustamante
 
SharePoint Saturday The Conference DC - Are you who you say you are share poi...
SharePoint Saturday The Conference DC - Are you who you say you are share poi...SharePoint Saturday The Conference DC - Are you who you say you are share poi...
SharePoint Saturday The Conference DC - Are you who you say you are share poi...
Liam Cleary [MVP]
 
Developing social solutions on Microsoft technologies (SP Social and Yammer)
Developing social solutions on Microsoft technologies (SP Social and Yammer)Developing social solutions on Microsoft technologies (SP Social and Yammer)
Developing social solutions on Microsoft technologies (SP Social and Yammer)
SPC Adriatics
 
Demystifying SharePoint Infrastructure – for NON-IT People
 Demystifying SharePoint Infrastructure – for NON-IT People  Demystifying SharePoint Infrastructure – for NON-IT People
Demystifying SharePoint Infrastructure – for NON-IT People
SPC Adriatics
 
IBM Watson Work Services Development
IBM Watson Work Services DevelopmentIBM Watson Work Services Development
IBM Watson Work Services Development
Van Staub, MBA
 
Dear Azure: External collaboration with Azure AD B2B
Dear Azure: External collaboration with Azure AD B2BDear Azure: External collaboration with Azure AD B2B
Dear Azure: External collaboration with Azure AD B2B
Sjoukje Zaal
 
Session 2 Integrating SharePoint 2010 and Windows Azure
Session 2   Integrating SharePoint 2010 and Windows AzureSession 2   Integrating SharePoint 2010 and Windows Azure
Session 2 Integrating SharePoint 2010 and Windows Azure
Code Mastery
 
Building Secure Extranets with Claims-Based Authentication #SPEvo13
Building Secure Extranets with Claims-Based Authentication #SPEvo13Building Secure Extranets with Claims-Based Authentication #SPEvo13
Building Secure Extranets with Claims-Based Authentication #SPEvo13
Gus Fraser
 
Securing SharePoint Apps with OAuth
Securing SharePoint Apps with OAuthSecuring SharePoint Apps with OAuth
Securing SharePoint Apps with OAuth
Kashif Imran
 
What's new 365 - Com Camp
What's new 365 - Com CampWhat's new 365 - Com Camp
What's new 365 - Com Camp
Elaine Van Bergen
 
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis JugoO365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
NCCOMMS
 
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environmentDEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
Felipe Prado
 
Windows Azure Active Directory
Windows Azure Active DirectoryWindows Azure Active Directory
Windows Azure Active Directory
Pavel Revenkov
 
Switching to Oracle Document Cloud
Switching to Oracle Document CloudSwitching to Oracle Document Cloud
Switching to Oracle Document Cloud
Brian Huff
 
External collaboration with Azure B2B
External collaboration with Azure B2BExternal collaboration with Azure B2B
External collaboration with Azure B2B
Sjoukje Zaal
 
SharePoint Saturday Austin - Share point authentication and authorization
SharePoint Saturday Austin - Share point authentication and authorizationSharePoint Saturday Austin - Share point authentication and authorization
SharePoint Saturday Austin - Share point authentication and authorization
Liam Cleary [MVP]
 
What‘s new in Office 365
What‘s new in Office 365What‘s new in Office 365
What‘s new in Office 365
SPC Adriatics
 
Portal and Intranets
Portal and Intranets Portal and Intranets
Portal and Intranets
Redar Ismail
 
WSO2Con USA 2017: Building a Secure Enterprise
WSO2Con USA 2017: Building a Secure EnterpriseWSO2Con USA 2017: Building a Secure Enterprise
WSO2Con USA 2017: Building a Secure Enterprise
WSO2
 
Understanding SharePoint Apps, authentication and authorization infrastructur...
Understanding SharePoint Apps, authentication and authorization infrastructur...Understanding SharePoint Apps, authentication and authorization infrastructur...
Understanding SharePoint Apps, authentication and authorization infrastructur...
SPC Adriatics
 
SharePoint Saturday The Conference DC - Are you who you say you are share poi...
SharePoint Saturday The Conference DC - Are you who you say you are share poi...SharePoint Saturday The Conference DC - Are you who you say you are share poi...
SharePoint Saturday The Conference DC - Are you who you say you are share poi...
Liam Cleary [MVP]
 
Developing social solutions on Microsoft technologies (SP Social and Yammer)
Developing social solutions on Microsoft technologies (SP Social and Yammer)Developing social solutions on Microsoft technologies (SP Social and Yammer)
Developing social solutions on Microsoft technologies (SP Social and Yammer)
SPC Adriatics
 
Demystifying SharePoint Infrastructure – for NON-IT People
 Demystifying SharePoint Infrastructure – for NON-IT People  Demystifying SharePoint Infrastructure – for NON-IT People
Demystifying SharePoint Infrastructure – for NON-IT People
SPC Adriatics
 
IBM Watson Work Services Development
IBM Watson Work Services DevelopmentIBM Watson Work Services Development
IBM Watson Work Services Development
Van Staub, MBA
 
Dear Azure: External collaboration with Azure AD B2B
Dear Azure: External collaboration with Azure AD B2BDear Azure: External collaboration with Azure AD B2B
Dear Azure: External collaboration with Azure AD B2B
Sjoukje Zaal
 
Session 2 Integrating SharePoint 2010 and Windows Azure
Session 2   Integrating SharePoint 2010 and Windows AzureSession 2   Integrating SharePoint 2010 and Windows Azure
Session 2 Integrating SharePoint 2010 and Windows Azure
Code Mastery
 
Building Secure Extranets with Claims-Based Authentication #SPEvo13
Building Secure Extranets with Claims-Based Authentication #SPEvo13Building Secure Extranets with Claims-Based Authentication #SPEvo13
Building Secure Extranets with Claims-Based Authentication #SPEvo13
Gus Fraser
 
Securing SharePoint Apps with OAuth
Securing SharePoint Apps with OAuthSecuring SharePoint Apps with OAuth
Securing SharePoint Apps with OAuth
Kashif Imran
 
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis JugoO365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
O365Con19 - Developing Timerjob and Eventhandler Equivalents - Adis Jugo
NCCOMMS
 
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environmentDEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
DEF CON 27 - DIRK JAN MOLLEMA - im in your cloud pwning your azure environment
Felipe Prado
 
Windows Azure Active Directory
Windows Azure Active DirectoryWindows Azure Active Directory
Windows Azure Active Directory
Pavel Revenkov
 
Switching to Oracle Document Cloud
Switching to Oracle Document CloudSwitching to Oracle Document Cloud
Switching to Oracle Document Cloud
Brian Huff
 

Similar to SharePoint Saturday The Conference DC - How the client object model saved the day (20)

Building dynamic applications with the share point client object model
Building dynamic applications with the share point client object modelBuilding dynamic applications with the share point client object model
Building dynamic applications with the share point client object model
Eric Shupps
 
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
SPTechCon
 
Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010
Ben Robb
 
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
Luis Du Solier
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn
 
Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012
daniel plocker
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
SharePoint Saturday NY
 
SFDC Inbound Integrations
SFDC Inbound IntegrationsSFDC Inbound Integrations
SFDC Inbound Integrations
Sujit Kumar
 
Basics Of Introduction to ASP.NET Core.pptx
Basics Of Introduction to ASP.NET Core.pptxBasics Of Introduction to ASP.NET Core.pptx
Basics Of Introduction to ASP.NET Core.pptx
1rajeev1mishra
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
WBUTTUTORIALS
 
StackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStackStackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStack
Chiradeep Vittal
 
Rest API and Client OM for Developer
Rest API and Client OM for DeveloperRest API and Client OM for Developer
Rest API and Client OM for Developer
InnoTech
 
06 web api
06 web api06 web api
06 web api
Bat Programmer
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
slire
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
Mike Melusky
 
Integrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST APIIntegrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST API
Espresso Logic
 
Dealing with and learning from the sandbox
Dealing with and learning from the sandboxDealing with and learning from the sandbox
Dealing with and learning from the sandbox
Elaine Van Bergen
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
Ido Flatow
 
SharePoint 2013 APIs
SharePoint 2013 APIsSharePoint 2013 APIs
SharePoint 2013 APIs
John Calvert
 
Unit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptxUnit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptx
AbhijayKulshrestha1
 
Building dynamic applications with the share point client object model
Building dynamic applications with the share point client object modelBuilding dynamic applications with the share point client object model
Building dynamic applications with the share point client object model
Eric Shupps
 
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 2: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
SPTechCon
 
Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010Introduction to the Client OM in SharePoint 2010
Introduction to the Client OM in SharePoint 2010
Ben Robb
 
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
Luis Du Solier
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn
 
Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012Client Object Model - SharePoint Extreme 2012
Client Object Model - SharePoint Extreme 2012
daniel plocker
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
SharePoint Saturday NY
 
SFDC Inbound Integrations
SFDC Inbound IntegrationsSFDC Inbound Integrations
SFDC Inbound Integrations
Sujit Kumar
 
Basics Of Introduction to ASP.NET Core.pptx
Basics Of Introduction to ASP.NET Core.pptxBasics Of Introduction to ASP.NET Core.pptx
Basics Of Introduction to ASP.NET Core.pptx
1rajeev1mishra
 
StackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStackStackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStack
Chiradeep Vittal
 
Rest API and Client OM for Developer
Rest API and Client OM for DeveloperRest API and Client OM for Developer
Rest API and Client OM for Developer
InnoTech
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
slire
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
Mike Melusky
 
Integrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST APIIntegrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST API
Espresso Logic
 
Dealing with and learning from the sandbox
Dealing with and learning from the sandboxDealing with and learning from the sandbox
Dealing with and learning from the sandbox
Elaine Van Bergen
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
Ido Flatow
 
SharePoint 2013 APIs
SharePoint 2013 APIsSharePoint 2013 APIs
SharePoint 2013 APIs
John Calvert
 
Unit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptxUnit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptx
AbhijayKulshrestha1
 

Recently uploaded (20)

Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 

SharePoint Saturday The Conference DC - How the client object model saved the day

  • 1. How the Client Object Model Saved the Day! Liam Cleary Solution Architect | SharePoint MVP
  • 2. About Me • Solution Architect @ SusQtech (Winchester, VA) • SharePoint MVP since 2007 • Working with SharePoint since 2002 • Worked on all kinds of projects • Internet • Intranet • Extranet • Anything SharePoint Really • Involved in Architecture, Deployment, Customization and Development of SharePoint
  • 3. It is a wise man who knows where courage ends and stupidity begins. Jerome Cady – Hollywood Screenwriter
  • 5. Agenda • Data Access In SharePoint • SharePoint 2007 • SharePoint 2010 • What is the Client Object Model? • Managed Code • Silverlight • ECMAScript • How can we use it? • How did it save the day? • NOTE: Not a heavy code session, well we will see!!
  • 6. Data Access In SharePoint 2007 • Historically we were tied to direct API or Web Services SharePoint Database SharePoint API Server Applications Web Services (Native / Custom) Client Applications
  • 7. Problems • Out of the box Web Services may not have the required methods • Custom Web Services can be very complicated to create • API is not rich enough • Custom API wrappers are created • Seen this again and again • Complicated to all from JavaScript / jQuery • Client Applications if developed are all custom, even data access • Applications are not really developed • See the same issues with every client
  • 8. Data Access In SharePoint 2010 • Updated for SharePoint 2010 • Similar Approach with a few tweaks SharePoint Database SharePoint API Web Services Client Object Model (Native / Custom) Client Applications Server Applications
  • 9. What is the Client Object Model? • “Knight in Shining Armor” for client application development • Simple and easy to use API • Consistent implementations • Abstracted methods from core API • Subset of the Types and Members from Microsoft.SharePoint namespace • Three flavors • .NET CLR • Silverlight • ECMAScript (JavaScript, Jscript) • Easy to Consume data from SharePoint
  • 10. Client Object Model Browser Based ECMA Script (JavaScript) ECMA Script Object Model SharePoint Server Object Model Proxy Client Services Client Proxy SQL Server Content Databases Managed Object Model .NET Managed (.NET & Silverlight)
  • 11. Client Object Model – Process • Data is retrieved in a specific way Client Application Server Commands Client.svc XML context.ExecuteQuery(); Commands JSON Process Results Send Back Results
  • 12. Client Object Model - Objects • Similar to core API • Naming slightly changed • Consistent across all implementations Server .NET Managed Silverlight JavaScript (Microsoft.SharePoint) (Microsoft.SharePoint.Client) (Microsoft.SharePoint.Cliernt.Silverlight) (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
  • 13. Client Object Model – Getting Started • No ClientContext = No Connection clientContext = new ClientContext(“http://mysharepointsite.com”); • Need to LOAD before you can READ clientContext.Load(web); clientContext.Load(web.Lists); • Must COMMIT requests in a BATCH clientContext.ExecuteQuery(); clientContext.ExecuteQueryAsync(succeedcallback, failurecallback);
  • 14. Client Object Model – Object Identities • Used to batch up objects that can be used before the “ExecuteQuery” ClientContext clientContext = new ClientContext(“http://siteurl”); List list = clientContext.Web.Lists.GetByTitle(“ListName”); CamlQuery camlQuery = new camlQuery(); camlQuery.ViewXml = “<View/>”; ListItemCollection listItems = list.GetItem(camlQuery); clientContext.Load(list); clientContext.Load(listItems); clientContext.ExecuteQuery(); • Once the objects have been set and executed they can be iterated through foreach(ListItem listItem in listItems) Console.WriteLine(“Title: ,1-”, listItem*“Title”+,
  • 15. Client Object Model – Lambda Expressions • Used trim results, filter or even increase performance Trimming ClientContext clientContext = new ClientContext("http://siteurl"); Web site = clientContext.Web; clientContext.Load(site, s => s.Title, s => s.Description); clientContext.ExecuteQuery(); Filter ClientContext clientContext = new ClientContext("http://siteurl"); ListCollection listCollection = clientContext.Web.Lists; IEnumerable<List> hiddenLists = clientContext.LoadQuery( listCollection . Where(list => !list.Hidden && list.BaseType == BaseType.DocumentLibrary)); clientContext.ExecuteQuery(); Performance ClientContext clientContext = new ClientContext("http://siteurl"); IEnumerable<List> lists = clientContext.LoadQuery( clientContext.Web.Lists.Include( list => list.Title, list => list.Hidden, list => list.Fields.Include( field => field.Title, field => field.Hidden))); clientContext.ExecuteQuery();
  • 16. Client Object Model – Asynchronous Processing • Ability to invoke intensive queries Asynchronously delegate void AsynchronousDelegate(); Public void Run() { ClientContext clientContext = new ClientContext("http://siteurl"); ListCollection lists = clientContext.Web.Lists; IEnumerable<List> newListCollection = clientContext.LoadQuery( lists.Include( list => list.Title)); AsynchronousDelegate executeQueryAsynchronously = new AsynchronousDelegate(clientContext.ExecuteQuery); executeQueryAsynchronously.BeginInvoke( arg => { clientContext.ExecuteQuery(); foreach (List list in newListCollection) Console.WriteLine("Title: {0}", list.Title); }, null); }
  • 17. Client Object Model - .NET • Provides easy access from remote .NET Clients to SharePoint Data • Can be used from Managed Code such as Office • Utilizes the following Assemblies • Microsoft.SharePoint.Client.dll (281 KB) • Microsoft.SharePoint.Client.Runtime.dll (145 KB) • Compared to Microsoft.SharePoint.dll (15.3 MB) • SQL Like • Batch Processing
  • 18. Client Object Model – Managed Code DEMO
  • 19. Client Object Model - Silverlight • Use Silverlight on page or in a web part • Web Part can contain custom properties by using the “InitParams” property • XAP file deployed to Layouts or Content Database • Once the Silverlight is loaded it can access the Client Object Model • Stored in the “14TEMPLATELAYOUTSClientBin” directory • Utilizes the following Assemblies • Microsoft.SharePoint.Client.Silverlight.dll (262 KB) • Microsoft.SharePoint.Client.Silverlight.Runtime.dll (138 KB) • Must call “clientContext.ExecuteQueryAsync”
  • 20. Client Object Model – Silverlight (WPF) DEMO
  • 21. Client Object Model - ECMAScript • Page needs to load the “SP.js” • Use <SharePoint:ScriptLink> • Can use debug version • Use <SharePoint:ScriptLink …ScriptMode=“Debug”> • Client Context can be set using var clientContext = new SP.ClientContext.get_current(); Or var clientContext = new SP.ClientContext(); • SAVE TIME NOTE: Properties are case sensitive • SP.js (381 KB), SP.Debug.js (561 KB)
  • 22. Client Object Model – ECMAScript DEMO
  • 23. Client Object Model – Wrap-up • .NET CLR has a Sync Method whereas Silverlight CLR and JavaScript are Asynchronous • All requests are throttled, so be aware of performance • No ELEVATION of privilege capabilities • SPSecurity.RunWithElevatedPrivileges • Must handle the Synchronize and Update logic • Need to handle the efficient loading etc. of objects • Use LINQ • Use Lambda Expressions • Works well however an element of developer experience is needed to use
  • 24. Client Object Model – How did it save the day? • Quickly update multiple items on SharePoint • No direct Server Access • Using Forms Login also • Add “cool” functionality easily using ECMA Script • Inline editing • Able to track my wife's spending via SharePoint • Used Client Object Model to remotely check SharePoint list for expenditure and alert on desktop • Completely made up, but the reality is that simple, this could be done, as long as the data feed is available this is achievable
  • 25. Thank You • Personal Email: [email protected] • Work: http://www.susqtech.com • Twitter: @helloitsliam • Blog: www.helloitsliam.com