SharePoint 2010 Data Retrival Techinques

Posted by Jayant Sharma on Geeks with Blogs See other posts from Geeks with Blogs or by Jayant Sharma
Published on Tue, 03 Jul 2012 03:55:34 GMT Indexed on 2012/07/03 9:16 UTC
Read the original article Hit count: 453

Filed under:
In SharePoint, we have two options to perform CRUD operation.

1. using server side code
2. using client side code

using server side code, we have

1. CAML
2. LINQ

using client side code, we have

1. Client Object Model
    1.1.      Managed Client Object Model 
    1.2.     Silverlight Client Object Model
    1.3.     ECMA Client Object Model
2. SharePoint Web Services
3. ADO Data Service (based on REST Web Services)
4. Using RPC Call (owssvr.dll)


Which and when these options are used depend upon requirements. Every options are certain advantages and disadvantages. So, before start development of any new sharepoint project, it is important to understand the limitations of different methods.

Server Object Model is used when our application is host on the same server on which sharepoint is installed. while Client Side code is used to access sharepoint from client system. In SharePoint 2010 specially Client Object Model (COM) are introduced to perform the sharepoint operations from client system.


Advantage of CAML:
    - 
It is fast.
    -  Can be use it from all kind of technology like Silverlight, or Jquery
    -  You can use U2U CAML Query builder to generate CAML Query.

Disadvantage Of CAML:
    - Error Prone, as we can detect the error only at runtime

Advantage of LINQ:
    -  Object Oriented technique (Object Relation Model)
    -  LINQ  to SharePoint provider are working with Strongly Type List Item Objects, So intellisence are present at runtime
    -  No need of knowledge of CAML
    -  Less Error Prone as it as it uses C# syntex.
    -  You can compare two Fields of SharePoint List

Disadvantage Of LINQ:

    -  List Attachment is not supported in SPMetal Tool
    -  Created By, Created, Modified and Modified By Fields are not created by SPMetal Tool.
    -  Custom fields are not created by SPMetal Tools
    -  External Lists are not supported
    -  Though at backend LINQ genenates CAML Query so it is slower than directly using CAML in Code.
  
Advantage of Client Object Model
    -  Used to access sharepoint from client system
    -  No WebServer is required at Client End
    - Can use Silverlight and JavaScripts to make better and fast User experience

Disadvantage of Client Object Model
    -  You cannot use RunwithEleveatedPrivilege
    - Cross Site Collection query are not possible
    - Lesser API's are available

ADO.Net Data Services:
    -  Only List based operations are possible, other type of operations are not possible.

SharePoint Web Services and RPC Call:
    - Previously it was used in SharePoint 2007 but after the introduction  of Client Object Model,  Microsoft recommends not to use Web Services to fetch data from SharePoint. In SharePoint 2010 it is avaliable only for backward compatibility.
Ref:
http://msdn.microsoft.com/en-us/library/ee539764


Jayant Sharma

© Geeks with Blogs or respective owner