Populate a Sharepoint list from an SQL Database

Published on Author peter.stilgoeLeave a comment

If you are wanting to populate a Sharepoint list from an SQL database or populate a SQL database from a Sharepoint list you can do this failry easily using SSIS & the SharePoint List Source and Destination Adapter project on Codeplex.

This sample illustrates the creation of a a source and destination adapter in C#, using the public APIs for Microsoft SQL Server Integration Services. The component connects to SharePoint through a proxy dll, which wraps the complexities of working with the SharePoint Lists Webservice.

The Specific Features of the included SSIS Components are:

SharePoint Source Component
– Auto-detects all of the public fields from a SharePoint List or view of the list.
– Supports removal of fields from the output flow, which optimizes the query against SharePoint for increased performance.
– Supports restricting SharePoint data by a custom CAML query, which can be provided through a variable expression for fine tuned filtering over large lists.
– Provides a tuning feature for the # of rows to return at a time. Often with SharePoint, large lists need to be brought over in smaller batches than wide (many field) lists, or else the Webservice will die. The batchsize lets you specify a solid size that works for your list.

SharePoint Destination Component
– Auto-detects all of the editable fields from a SharePoint List
– Only fields bound to columns from the input flow will be ‘updated’, for performance.
– Supports deleting rows by ID
Included Bonus – SharePoint Utility

To simplify the adapter code and keep the SharePoint routines generic, a proxy VB.Net component is included which access the SharePoint Webservice API. It includes a very flexible api for getting SharePoint List information, which is used by the Components above. In addition, it can publish and remove files from a document library.

Component Features
Unique features that may inspire you to create great custom SSIS components:
• Extensive Validation: Validation for this component actively goes against the SharePoint Site to verify the properties are valid.
• Values from Expressions: This component supports external variables, which can be expressions, and can be attached to the source component to customize the query. Similar to the CommandText for the other Sql Components
• Linq: The Component has been written using Linq with .net 3.5 and shows how elements such as the metadata and columns can be combined to create a readable usage in a Linq format.
• Custom properties: The component keeps its configuration in custom properties on itself, inputs, and input columns.
• SharePointUtility Component: Simplifies access to the SharePoint Lists / Views WS using Linq friendly objects

Sharepoint List Source & Destination project on Codeplex

Leave a Reply