Wednesday, March 2, 2011

SharePoint 2010: Select the best option for accessing SharePoint data from clients

There are few ways you can access data stored in SharePoint from a non-SharePoint application.

  • Client Object Model (OM): SharePoint provides three flavors of Client OM (Managed, EcmaScript and Silverlight)
  • Asp.Net web Service: The legacy web services of SharePoint 2007 are still supported for backward compatibility. We should try to avoid using these legacy web services for green field development.
  • REST-based Service (SharePoint 2010 Provided): SharePoint 2010 provides new set of WCF service which is REST enabled.
  • Custom WCF Service: There’s another option of developing custom WCF service of your own.

Let’s discuss which options you’ll take into account in selecting the best suitable options for your applications:


Client Object Mode (OM)

I think Client Object Model is the best choice in most of the cases. If you want to access SharePoint data from SharePoint webpart, then you can use Client OM (EcmaScript) to access data in SharePoint. If you are trying to access SharePoint data from Silverlight then you can use  Client OM for Silverlight. And most of all you can use Managed Client OM, in supported .net language to access SharePoint data.

So Client OM is surely your first choice. But in many cases you can’t use Client OM, especially in cases where you are trying to access SharePoint data from non-Microsoft platform, like Java. Also if your migrating your application from SharePoint 2003/2007 and you are already using web service, then you don’t have much choice but to use the legacy web services.


Asp.Net Web Services

SharePoint 2007 comes with built-in web services. These legacy web services are still in SharePoint to support backward-compatibility but whenever you have the option to avoid them, please do so. The only reason I see to use these legacy web services is for applications migrating from pre-SharePoint 2010 to SharePoint 2010. Maybe this is the last version of SharePoint with the support of the legacy web services (at least I hope so). Few legacy services are listed below:

  • /_vit_bin/Lists.asmx
  • /_vit_bin/Copy.asmx


SharePoint WCF Services (REST-based)

The new addition of extensibility point in SharePoint 20l10 is WCF services. If you are planning to manipulate SharePoint data from different platforms, like Java, then these WCF services are the excellent option to go with. If you install WCF data service updates, then these WCF services enable REST-based request processing. For more information on REST-based interface of SharePoint WCF services, please follow the MSDN link. You can also use these WCF services from .net applications. You can get the help from MSDN on how to use these WCF services in .net applications. Few new WCF services available in SharePoint 2010, are listed below:

  • /_vti_bin/ListData.svc
  • /_vti_bin/Client.svc


Custom WCF Service

In real world, we rarely happy with out of the box functionalities. We need to customize a lot to happy our clients. Similarly we may need to develop our own WCF services. Writing a custom web service in SharePoint 2007 was a very difficult task. But in SharePoint 2010, writing a custom WCF service is much easier now. If you install Community Kit for SharePoint (CKS) Visual Studio extension from CodePlex, you can develop a custom SharePoint Service easily. There’s also manual process of developing custom WCF Server in SharePoint described in MSDN: WCF Services in SharePoint and Creating Custom WCF Service. I’ll try to post more details on how to use CKS add-in to develop custom WCF service in another post.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.