Read an object variable having “FileInfo” object content.

May 22 2020 12:01 AM
I'm trying to loop and read an object variable(as shown in the pic) where it has the file details(name/size/datemodified) from a share point location. (The varible is passed from an SSIS -Sharepoint task to SCript Task)
 
I found that an object cannot be used in a foreach enumerator, and i'm not sure how to proceed with this one. Any help is much appreciated.
  1. using System;  
  2. using System.Data;  
  3. using Microsoft.SqlServer.Dts.Runtime;  
  4. using System.Windows.Forms;  
  5. using System.Data.OleDb;  
  6.         public void Main()  
  7.         {  
  8.   
  9.             String Filename = "";  
  10.             Var fileinfo = Dts.Variables["User::DvarObj"].Value;  
  11.   
  12.             foreach(var i in fileinfo)  
  13.             {  
  14.                 Filename = i.Name;  
  15.                 MessageBox.Show(Filename);  
  16.             }  
  17.   
  18.                 Dts.TaskResult = (int)ScriptResults.Success;  
  19.        }  

Answers (6)