none
Client Object Model vs Server Object Model RRS feed

  • Question

  • Hi,

    I know that the CSOM is working on the client side and that minimal the server risk and make the server performance high at the same time.

    But I need to know, when should I use the CSOM instead of Server Side Object Model??

    and what is the difference between CSOM and JSOM (JavaScript Client Object Model)?

    Regards,

    Abdelfattah.

    Monday, April 17, 2017 7:37 AM

Answers

  • Relatively CSOM model is faster compare to Server side. Because request has been in processed as batch in CSOM. Rather sending each request back to server like server side model.

    JSOM is supported in SharePoint 2013 version onwards. It works cross site in SharePoint 2013. JSOM is set of javascripts files and easy for doing basic sharepoint stuff doing actions on sites, list and document lib etc..

    • SP.js
    • SP.Core.js
    • SP.Ribbon.js
    • SP.Runtime.js

    ----------------------------------------------------------------------------

    Thanks

    Lalith

    ----------------------------------------

    Please mark as Answer, if this post solves your issue.


    Monday, April 17, 2017 12:01 PM
  • Server Side Object Model: When you are utilizing Server Side Object Model then you need to write the code in C#.NET or VB.NET, which will be executing at server side and required deployment on Server where SharePoint installed. 

    CSOM Client Side: CSOM model implemented using the WCF service (client.svc) and We can utilize CSOM code in

         >C#.NET or VB.NET.: In this case, you can access SharePoint instance from Client machine by creating Window or Console application. In this case no need to deploy the code on server.

    JSOM (ECMAScript Client Object Model): In this case, you can access SharePoint instance from SharePoint hosted page by using the JQuery add-on or without JQuery, but SP.js file (with other required files) should be present on the page. At the end JSOM also connecting with the WCF service client.svc to access the SharePoint instance.

    You can run the code using 


     	function DocumentLoaded () {
                    SP.SOD.loadMultiple(['sp.js', 'sp.runtime.js', 'strings.js', 'init.js', 'sp.ui.dialog.js'], AnalystReport.Search.Start);
                }
    
        function Start (){
            // to support synchronous and asynchronous updates of the site first load all scripts and finally execute functions if scripts are loaded
            // sequentially load all relevant scripts
            SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function(){});
            SP.SOD.executeFunc('sp.runtime.js', null, function(){});
            SP.SOD.executeFunc('init.js', null, function(){});
            SP.SOD.executeFunc('sp.ui.dialog.js', 'SP.ClientContext', function(){});
    		
            // nested checks, if relevant scripts are already loaded
            ExecuteOrDelayUntilScriptLoaded(function(){
                ExecuteOrDelayUntilScriptLoaded(function(){
                    ExecuteOrDelayUntilScriptLoaded(function(){
                        ExecuteOrDelayUntilScriptLoaded(Init,"sp.ui.dialog.js");
                    },"init.js");
                },"sp.runtime.js");
            }, "sp.js");
    
                }
    
    function InIt()
    {
     //--Write your logic to access the SharePoint Data
    }
    
    
    //-----------Document.Ready----::Start::------------------//
                $(document).ready(function () {
                    DocumentLoaded();
                });
    //-----------Document.Ready----::End::------------------//

    Reference:

    https://msdn.microsoft.com/en-in/library/ff798388.aspx

    https://msdn.microsoft.com/en-in/library/ff798473.aspx

    https://msdn.microsoft.com/en-us/library/ee537247(v=office.14).aspx

    https://www.codeproject.com/articles/560049/createplusaplussharepointplus-pluslistplususing



    Thanks, Amit Kumar, LinkedIn Profile ** My Blog
    Please click "Mark As Answer" if this post solves your problem or "Vote As Helpful" if it was useful


    Tuesday, April 18, 2017 12:12 PM
  • The advantage of the CSOM is that you do not need to deploy the code on the Server to use them in your program. It can be used in any Desktop or Web Client. You don't need to do the safe control entry, no GAC deployments and No need of restaring IIS and No overload on server. 

    For information refer below link...

    Choose Right API

    Diff CSOM vs SSOM vs JSOM vs REST

    Monday, April 17, 2017 9:41 AM
  • Hi Abdelfattah,

    If you want to develop a ASP.NET web application or windows Form application or create SharePoint Provider hosted add-in, and need access SharePoint content, we need use CSOM instead of Server Side Object Model to achieve it.

    If you create a SharePoint farm solution, please use Server Side Object Model to achieve it.

    CSOM: Client-side object model. C# (or Visual Basic) only

    JSOM: JavaScript object model. JavaScript only

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, April 18, 2017 6:43 AM
    Moderator
  • CSOM: Stand for Client-side object model

    • The language used:  C# or Visual Basic.
    • SharePoint versions:  2013 and 2016.

    SSOM: Stand for the Server-side object model. 

    • The language used:  C# or Visual Basic.
    • SharePoint versions: 2007,2010, 2016 and 2016.
    • Restrictions: Must be deployed on the farm side. 

    JSOM: Stand for the JavaScript object model. 

    • The language used:  JavaScript.
    • SharePoint versions: 2013,2016.

    Which one should be used?

    every model has its advantage and disadvantage and this will depend on your requirements to select the proper model. so please check Choose the right API set in SharePoint 2013 that will help you to decide when you use the proper model based on your requirements!

    Tuesday, April 18, 2017 12:48 PM

All replies

  • The advantage of the CSOM is that you do not need to deploy the code on the Server to use them in your program. It can be used in any Desktop or Web Client. You don't need to do the safe control entry, no GAC deployments and No need of restaring IIS and No overload on server. 

    For information refer below link...

    Choose Right API

    Diff CSOM vs SSOM vs JSOM vs REST

    Monday, April 17, 2017 9:41 AM
  • Relatively CSOM model is faster compare to Server side. Because request has been in processed as batch in CSOM. Rather sending each request back to server like server side model.

    JSOM is supported in SharePoint 2013 version onwards. It works cross site in SharePoint 2013. JSOM is set of javascripts files and easy for doing basic sharepoint stuff doing actions on sites, list and document lib etc..

    • SP.js
    • SP.Core.js
    • SP.Ribbon.js
    • SP.Runtime.js

    ----------------------------------------------------------------------------

    Thanks

    Lalith

    ----------------------------------------

    Please mark as Answer, if this post solves your issue.


    Monday, April 17, 2017 12:01 PM
  • Hi Abdelfattah,

    If you want to develop a ASP.NET web application or windows Form application or create SharePoint Provider hosted add-in, and need access SharePoint content, we need use CSOM instead of Server Side Object Model to achieve it.

    If you create a SharePoint farm solution, please use Server Side Object Model to achieve it.

    CSOM: Client-side object model. C# (or Visual Basic) only

    JSOM: JavaScript object model. JavaScript only

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, April 18, 2017 6:43 AM
    Moderator
  • Hi Dennis,

    many thanks for your reply, but I need to know in which situation should I use one of the following object models:

    - Client Object Model

    - Rest/OData endpoints

    - JavaScript Object Model

    - Silverlight Object Model

    I just need to know when (situation happened) what I should use of (object models).

    Regards,

    Tuesday, April 18, 2017 7:45 AM
  • Hi,

    Please check this:

    If you want to do this ...

    ... use these APIs

    Create an ASP.NET web application that performs create/read/update/deleted (CRUD) operations across a firewall on SharePoint data or external data that is surfaced in SharePoint by a Microsoft Business Connectivity Services (BCS) external content type

    JavaScript client object model

    Create an ASP.NET web application that performs CRUD operations on SharePoint data or external data that is surfaced in SharePoint by a BCS external content type, but does not have to call SharePoint across a firewall

    .NET Framework client object model, Silverlight client object model, or REST/OData endpoints

    Create a LAMP web application that performs CRUD operations on SharePoint data or external data that is surfaced in SharePoint by a BCS external content type

    REST/OData endpoints

    Create a Windows Phone app that performs CRUD operations on SharePoint data

    Mobile client object model

    Create a Windows Phone app that uses the Microsoft Push Notification Service to alert the mobile device of events in SharePoint

    Mobile client object model and the server object model

    Create an iOS or Android app that performs CRUD operations on SharePoint data

    REST/OData endpoints

    Create a .NET Framework application that performs CRUD operations on SharePoint data

    .NET Framework client object model

    Create a Silverlight application that performs CRUD operations on SharePoint data

    Silverlight client object model

    Create an HTML/JavaScript application that performs CRUD operations on SharePoint data

    JavaScript client object model

    Create an Office Add-in that works with SharePoint

    JavaScript client object model

    Create a custom Windows PowerShell command

    Server object model

    Create a timer job

    Server object model

    Create an extension of Central Administration

    Server object model

    Create consistent branding across an entire SharePoint farm

    Server object model

    Create a custom Web Part, application page, or ASP.NET user control

    Server object model

    More information is here:

    https://msdn.microsoft.com/en-us/library/office/jj164060.aspx

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, April 18, 2017 8:01 AM
    Moderator
  • Server Side Object Model: When you are utilizing Server Side Object Model then you need to write the code in C#.NET or VB.NET, which will be executing at server side and required deployment on Server where SharePoint installed. 

    CSOM Client Side: CSOM model implemented using the WCF service (client.svc) and We can utilize CSOM code in

         >C#.NET or VB.NET.: In this case, you can access SharePoint instance from Client machine by creating Window or Console application. In this case no need to deploy the code on server.

    JSOM (ECMAScript Client Object Model): In this case, you can access SharePoint instance from SharePoint hosted page by using the JQuery add-on or without JQuery, but SP.js file (with other required files) should be present on the page. At the end JSOM also connecting with the WCF service client.svc to access the SharePoint instance.

    You can run the code using 


     	function DocumentLoaded () {
                    SP.SOD.loadMultiple(['sp.js', 'sp.runtime.js', 'strings.js', 'init.js', 'sp.ui.dialog.js'], AnalystReport.Search.Start);
                }
    
        function Start (){
            // to support synchronous and asynchronous updates of the site first load all scripts and finally execute functions if scripts are loaded
            // sequentially load all relevant scripts
            SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function(){});
            SP.SOD.executeFunc('sp.runtime.js', null, function(){});
            SP.SOD.executeFunc('init.js', null, function(){});
            SP.SOD.executeFunc('sp.ui.dialog.js', 'SP.ClientContext', function(){});
    		
            // nested checks, if relevant scripts are already loaded
            ExecuteOrDelayUntilScriptLoaded(function(){
                ExecuteOrDelayUntilScriptLoaded(function(){
                    ExecuteOrDelayUntilScriptLoaded(function(){
                        ExecuteOrDelayUntilScriptLoaded(Init,"sp.ui.dialog.js");
                    },"init.js");
                },"sp.runtime.js");
            }, "sp.js");
    
                }
    
    function InIt()
    {
     //--Write your logic to access the SharePoint Data
    }
    
    
    //-----------Document.Ready----::Start::------------------//
                $(document).ready(function () {
                    DocumentLoaded();
                });
    //-----------Document.Ready----::End::------------------//

    Reference:

    https://msdn.microsoft.com/en-in/library/ff798388.aspx

    https://msdn.microsoft.com/en-in/library/ff798473.aspx

    https://msdn.microsoft.com/en-us/library/ee537247(v=office.14).aspx

    https://www.codeproject.com/articles/560049/createplusaplussharepointplus-pluslistplususing



    Thanks, Amit Kumar, LinkedIn Profile ** My Blog
    Please click "Mark As Answer" if this post solves your problem or "Vote As Helpful" if it was useful


    Tuesday, April 18, 2017 12:12 PM
  • CSOM: Stand for Client-side object model

    • The language used:  C# or Visual Basic.
    • SharePoint versions:  2013 and 2016.

    SSOM: Stand for the Server-side object model. 

    • The language used:  C# or Visual Basic.
    • SharePoint versions: 2007,2010, 2016 and 2016.
    • Restrictions: Must be deployed on the farm side. 

    JSOM: Stand for the JavaScript object model. 

    • The language used:  JavaScript.
    • SharePoint versions: 2013,2016.

    Which one should be used?

    every model has its advantage and disadvantage and this will depend on your requirements to select the proper model. so please check Choose the right API set in SharePoint 2013 that will help you to decide when you use the proper model based on your requirements!

    Tuesday, April 18, 2017 12:48 PM