SSIS SharePoint Data Source

This post shows you how to use Office 365 SharePoint as data source in SSIS Data Flow.


1. You already have basic knowledge on SSIS.

2. You have installed SharePoint SDK to your development environment

3. SQL Server Data Tool is installed

4. You have Office 365 SharePoint online login.

It used to have a codeplex SharePoint data source but it just didn’t last for very long. A lot of people are still looking for a SSIS SharePoint data source. In this post, I will show you how to create a SSIS SharePoint Source with the combination of SharePoint SDK and Script Component in SSIS.

1. Create a SSIS project.

2. Drag Data Flow Task to Control Flow page. Double click the Data Flow Task. Drag Script Component to Data Flow page. When Select Script Component Type pops up then select Source.

3. Double click the Script Component. Click on Inputs and Outputs.

4. Expand the Output 0.Click the Add Column. In this example, I will add 2 output columns, CategoryIdOut and ProductNameOut.

5. Click the Script. Click Edit Script…

6. Replace the CreateNewOutputRows method with the following code. Of course, you need to change the siteUrl, password, and login name.

void CreateNewOutputRows()


    string siteUrl =”;

    ClientContext clientContext = new ClientContext(siteUrl);

    string password = “password”;

    SecureString securePassword = new SecureString();

    foreach (char c in password)




    clientContext.Credentials = new SharePointOnlineCredentials(“”, securePassword);

    SP.List oList = clientContext.Web.Lists.GetByTitle(“ProductList”);

    CamlQuery camlQuery = new CamlQuery();

    camlQuery.ViewXml = “<View><RowLimit>100</RowLimit></View>”;

    ListItemCollection collListItem = oList.GetItems(camlQuery);


        items => items.Include(

        item => item.Id,

        item => item[“CategoryId”],

        item => item[“ProductName”]));


    foreach (ListItem oListItem in collListItem)


        Console.WriteLine(“ID: {0} \nId: {1} \nName: {2}”, oListItem, oListItem.Id, oListItem[“ProductName”]);


        Output0Buffer.ProductNameOut = oListItem[“ProductName”].ToString();

        Output0Buffer.CategoryIdOut = oListItem[“CategoryId”].ToString();



7. Finally drag a OLE DB destination. For me, I am using the Northwind database, Products table.

About chanmingman

Since March 2011 Microsoft Live Spaces migrated to Wordpress ( till now, I have is over 1 million viewers. This blog is about more than 50% telling you how to resolve error messages, especial for Microsoft products. The blog also has a lot of guidance teaching you how to get stated certain Microsoft technologies. The blog also uses as a help to keep my memory. The blog is never meant to give people consulting services or silver bullet solutions. It is a contribution to the community. Thanks for your support over the years. Ming Man is Microsoft MVP since year 2006. He is a software development manager for a multinational company. With 25 years of experience in the IT field, he has developed system using Clipper, COBOL, VB5, VB6, VB.NET, Java and C #. He has been using Visual Studio (.NET) since the Beta back in year 2000. He and the team have developed many projects using .NET platform such as SCM, and HR based applications. He is familiar with the N-Tier design of business application and is also an expert with database experience in MS SQL, Oracle and AS 400.
This entry was posted in .Net, Cloud, Community, Computers and Internet, Data Platform and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.