title: Download files from a SharePoint folder in SSIS
body: <p>I am trying to download multiple files from a SharePoint site. </p>
  
  <p>I have it working for one file, where I know the filename, by using a Script Task</p>
  
  <pre><code>WebClient client = new WebClient();
  client.Credentials = GetCredentials();// Separate Method
  client.DownloadFile(spFolderURL + "Filename.xlsx", spLocalFolder + "Filename.xlsx")
  </code></pre>
  
  <p>but I need to be able to loop through all the files within the folder and dynamically get the file name.</p>
  
  <p>I am trying this <a href="https://www.codeproject.com/Articles/20358/Uploading-Deleting-and-Downloading-a-File-from-Sha" rel="nofollow noreferrer">code project</a> solution and the solution below, I only need to download one file type (.xlsx).</p>
  
  <pre><code>using (SPSite oSite = new SPSite(spFolderURL))
  {
    using (SPWeb oWeb = oSite.OpenWeb())
    {
      SPList list = oWeb.Lists["listname"];
  
      WebClient client = new WebClient();
  
      SPListItemCollection oItemCol = list.GetItems();
      foreach (SPListItem oItem in oItemCol)
      {
          string strID = Convert.ToString(oItem["ID"]);
          SPFolder folder = oWeb.Folders["Lists"].SubFolders["Tasks"].SubFolders["Attachments"].SubFolders[strID];
          foreach (SPFile file in folder.Files)
          {
              client.Credentials = GetCredentials();// Separate Method
              client.DownloadFile(spFolderURL + "Filename.xlsx", spLocalFolder + "Filename.xlsx")
          }
  
      }
    }
  }
  </code></pre>
  
  <p>But I can't seem to get the SPSite and other SharePoint items recognised.</p>
  
  <p>I have added a reference in the script to Microsoft.SharePoint.Client, but it looks like these items need Microsoft.SharePoint, I can't find that in the list of available assemblies.</p>
  
  <p>I am using Visual Studio 2013 </p>
  
  <p>***EDIT</p>
  
  <p>Have done further research I needed to download the <a href="https://marketplace.visualstudio.com/items?itemName=KingswaySoft.SSISIntegrationToolkitforMicrosoftSharePoint" rel="nofollow noreferrer">SharePoint list adapters</a> I am now able to access the SharePoint lists to extract the file names required.</p>