How to download files from SharePoint Online using SSIS

Introduction

sharepoint iconIn today’s data-driven world, the ability to seamlessly integrate and transfer files between different platforms is crucial for efficient business operations. If you’re a user of SQL Server Integration Services (SSIS) and looking to integrate SharePoint Online into your data workflow, you’re in luck. ZappySys SSIS PowerPack offers a powerful SharePoint Online Connector that makes downloading files from SharePoint Online a breeze. In this guide, we’ll walk you through the process of downloading files from SharePoint Online using SSIS and the ZappySys SSIS PowerPack SharePoint Online Connector.

Prerequisites

Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
  1. SSIS designer installed. Sometimes it is referred to as BIDS or SSDT (download it from the Microsoft site).
  2. Basic knowledge of SSIS package development using Microsoft SQL Server Integration Services.
  3. Make sure ZappySys SSIS PowerPack is installed (download it, if you haven't already).
  4. (Optional step). Read this article, if you are planning to deploy packages to a server and schedule their execution later.

Download files from SharePoint Online with SSIS:

In this section, we will learn how to configure and use SharePoint Online Connector in the API Source & API Destination to download files from SharePoint Online.

  1. Begin with opening Visual Studio and Creating a New Project.
  2. Select Integration Service Project and in the new project window set the appropriate name and location for the project. Click OK.
  3. In the new SSIS project screen you will find the following:
    1. SSIS ToolBox on the left sidebar
    2. Solution Explorer and Property Window on the right bar
    3. Control flow, data flow, event Handlers, Package Explorer in tab windows
    4. Connection Manager Window at the bottom
    zappysys ssis project with toolbox

    SSIS Toolbox – ZappySys Tasks

    NOTE: If you don’t see ZappySys SSIS PowerPack Task or Components in the SSIS Toolbox, please refer to this help link.
  4. Now, Drag and Drop the SSIS Data Flow Task from the SSIS Toolbox. Double-click on the Data Flow Task to see the Data Flow Designer.
  5. From the SSIS toolbox drag and drop API Source (Predefined Templates) on the data flow designer surface, and double-click on it to edit it:
  6. Select New Connection to create a new connection:

Configuring the SharePoint Online Connector

  1. Use a preinstalled SharePoint Online Connector from the Popular Connector List or press the Search Online radio button to download SharePoint Online Connector. Once downloaded simply use it in the configuration:
    SSIS ZS API Connection Manager - Select SharePoint Online Connector

    SSIS ZS API Connection Manager – Select SharePoint Online Connector

  2. Proceed with selecting the desired Authentication Type. Then select API Base URL (in most cases default one is the right one). Finally, fill in all the required parameters and set optional parameters if needed.
  3. After configuring all the required properties in the API Connection Manager, please click on the “Test Connection” button to confirm that the connection is established successfully.

    Method1: Connect to SharePoint Online using User Credentials [OAuth]

    You may press a link Steps to Configure which will help set certain parameters.

    SSIS ZS API Connection Manager - Generate Token - SharePoint Online with User Credentials

    SSIS ZS API Connection Manager – Generate Token – SharePoint Online with User Credentials

    Method2: Connect to SharePoint Online using Application Credentials [OAuth]

    You may press a link Steps to Configure which will help set certain parameters.

    SSIS API Source - Generate Token - SharePoint Online with Application Credentials

    SSIS API Source – Generate Token – SharePoint Online with Application Credentials

How to download a single file from SharePoint Online

In the API Source Component, we’ve chosen the API Connection Manager. Next, we need to configure the remaining properties of the component to download the single file from SharePoint Online.

  1. Choose the Download file endpoint from the “Select Table/Endpoint” dropdown menu.
  2. Please choose DriveId from the drop-down menu.
  3. Please set the FileId that indicates which file you wish to download. This is an essential parameter for the download process.
  4. Please set the local folder’s physical path which indicates the desired file being downloaded by setting the TargetFilePath parameter.
  5. If you intend to replace the local file with the one being downloaded, please select the ‘AlwaysOverwrite‘ option from the dropdown menu labeled ‘FileOverwriteMode‘. Alternatively, you can choose ‘FileIfExists’ or ‘SkipIfExists’ based on your specific needs.

Please refer to the sample screenshot below.

SSIS API Source - SharePoint Online - Download Single File

SSIS API Source – SharePoint Online – Download Single File

Once you have configured all the mentioned properties above, please click on the “Preview Data” button to initiate the API call. With just a few clicks, we have successfully configured the call to SharePoint Online using the ZappySys SharePoint Online Connector for downloading a Single file from SharePoint Online.

How to download multiple files from SharePoint Online

In the API Destination Component, we have chosen the API Connection Manager. Now, we must proceed to configure the remaining properties of the component to facilitate the download of multiple files from SharePoint Online. Additionally, we should make use of an OLE DB Source and Derived Column component to map the files for the download process.

  1. Drag and drop the OLE DB Source Component from the SSIS Toolbox. Double-click on the OLE D B Source Component to initiate its configuration.
    OLE DB Source - Drag and Drop

    OLE DB Source – Drag and Drop

  2. Create a new OLE DB Connection Manager and configure your SQL Server settings for the connection. Next, select the Data access mode, specify the name of the table or view, or write an SQL Command. Afterward, click on the ‘Preview’ button to view a preview and check the ‘Columns’ tab for the source columns.
    SSIS OLE DB Source - Configure SQL Connection and fetch the table data

    SSIS OLE DB Source – Configure SQL Connection and fetch the table data

  3. Next, drag and drop the Derived Column Component from the SSIS Toolbox. Double-click on the Derived Column Component to begin its configuration.
    Drag and drop the Derived Column

    Drag and drop the Derived Column

  4. Now, add a new Derived Column by setting the expression to concatenate FilePath and FileName. Click ‘OK’ to save the configuration.
    SSIS Derived Column - Add New Column and Set Expression

    SSIS Derived Column – Add New Column and Set Expression

  5. Now, drag and drop the API Destination Component from the SSIS Toolbox. Double-click on the API Destination Component to begin its configuration.
    Drag and Drop the SSIS API Destination Component

    Drag and Drop the SSIS API Destination Component

  6. Double-click on the API Destination component to configure it for downloading multiple files from SharePoint Online.
    1. Choose the Download file endpoint from the “Select Table/Endpoint” dropdown menu.
    2. Please specify the ‘FileOverwriteMode’ option as ‘AlwaysOverwrite,’ or you can choose ‘FailIfExists’ or ‘SkipIfExists’ options based on your requirements.
      Please refer to the sample screenshot below.
      SSIS API Destination Component - Configure Settings Tab to download File from SharePoint Online

      SSIS API Destination Component – Configure Settings Tab to download Files from SharePoint Online

    3. Now, go to the Mappings tab and specify the source columns with the corresponding target properties.
      Note: Here We’re mapping FileID with $$Id and FileNameWithPath with $$ResponseDataFile. You can create mappings based on your Source columns
      Please refer to the sample screenshot below
      SSIS API Destination Component - Configure the Mappings Tab to download multiple files from SharePoint Online

      SSIS API Destination Component – Configure the Mappings Tab to download multiple files from SharePoint Online

  7. Once you have configured all the mentioned properties above, please click on the “Preview Data” button from the Settings tab to initiate the API call. With just a few clicks, we have successfully configured the call to SharePoint Online using the ZappySys SharePoint Online Connector for downloading multiple files from SharePoint Online.
    Please refer to the sample screenshot below.
    Download Multiple files from SharePoint Online

    Download Multiple files from SharePoint Online

Conclusion

In this blog, we learned how to connect with SharePoint Online using SSIS API Connection Manager and download single or multiple files from SharePoint Online using a combination of SSIS components, including the SSIS API Source component, SSIS API Destination component, OLE DB Source component, and Derived Column component.

Posted in SSIS API Source, SSIS Components, SSIS PowerPack and tagged , , , , , .