File Download via script task getting Cancelled

  • Hi:

    Can somebody help me with this? Thanks in advance for your contribution.

    I have a script task which download zip file from web through a range of dates. I already know few dates will have empty files downloaded. I have configured my task to keep iterating through setting propagate(on error) variable set to False.

    Now here is the problem; whenever my For Loop container reach to a date where the script task download an empty Zip file, package stop executing with Canceled status.

    here is the code for my script task;

    [font="Arial Black"]Public Sub Main()

    Dim nativeObject As Object = Dts.Connections("HTTP Summary File").AcquireConnection(Nothing)

    Dim Connection As New HttpClientConnection(nativeObject)

    Dim filename As String = "C:\Users\Imran\Downloads\" + Dts.Variables("User::DateText").Value.ToString + ".lis.z"

    Connection.DownloadFile(filename, True)

    Dts.Variables("User::FileName").Value = filename

    If File.Exists(filename) Then

    MessageBox.Show(String.Format("File {0} has been downloaded.", filename))

    End If

    Dts.TaskResult = ScriptResults.Success

    End Sub

    [/font]

    Thanks guys

    Imran

  • can somebody please take up this question? please.

    Thanks.

    Imran

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply