SharePoint 2010 Data Retrival Techinques
- by Jayant Sharma
In SharePoint, we have two options to perform CRUD operation.1. using server side code2. using client side codeusing server side code, we have 1. CAML2. LINQusing 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 Model2. SharePoint Web Services3. 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 runtimeAdvantage 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 ListDisadvantage 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 experienceDisadvantage of Client Object Model - You cannot use RunwithEleveatedPrivilege - Cross Site Collection query are not possible - Lesser API's are availableADO.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/ee539764Jayant Sharma