ssis - Want to know how to iterate through SSISDB folders, C# -


i trying write in c# powershell script ( see image ). went halfway not luck ( use these namespaces

using microsoft.sqlserver.dts.runtime; using microsoft.sqlserver; using microsoft.sqlserver.management.integrationservices; 

) managed code work upto point

sqlconnection ssisconnection = new sqlconnection(@"data  source=mhpdw2;initial catalog=master;integrated security=sspi;");  integrationservices ssisserver = new integrationservices(ssisconnection); foreach ?? ( continue ) 

but no luck after how iterate through each folder. btw powershell script works fine no issues. help! click link below powershell script code picture

powerscript code

$sqlconnectionstring = "data source=mhpapp2;initial catalog=master;integrated security=sspi;"  $sqlconnection = new-object system.data.sqlclient.sqlconnection $sqlconnectionstring     # create integration services object  $integrationservices = new-object $isnamespace".integrationservices" $sqlconnection   if ($integrationservices.catalogs.count -gt 0)   {       $catalog = $integrationservices.catalogs["ssisdb"]       write-host "enumerating folders..."       $folders = $catalog.folders       if ($folders.count -gt 0)      {          foreach ($folder in $folders)          {              $foldername = $folder.name              write-host "exporting folder " $foldername " ..."               # create new file folder              mkdir $projectfilepath"\"$foldername               # export projects              $projects = $folder.projects              if ($projects.count -gt 0)              {                  foreach($project in $projects)                  {                      $fullpath = $projectfilepath + "\" + $foldername + "\" + $project.name + ".ispac"                      write-host "exporting " $fullpath "  ..."                      [system.io.file]::writeallbytes($fullpath, $project.getprojectbytes())                  }              }          }      }  }   write-host "all done." 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -