Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

gardenburger

capturing errors for failed file transfers

I see how there is an example provided to log the Success of transferred files

For Each transfer As TransferEventArgs In transferResult.Transfers

   Dts.Events.FireInformation(0, Nothing, String.Format("Upload of {0} succeeded", transfer.FileName), Nothing, 0, fireAgain)
Next


but I haven't found any examples of how to log, or capture, Failed file transfers.

I notice there is a .Failures in TransferEventArgs and I suspect that somehow we can loop through and get error messages and other info about failed transfers.

Maybe something like this?:

For Each xtransfer As TransferEventArgs In transferResult.Failures

    Dim vErrMsg As String = xtransfer.Error.Message.ToString()
    Dts.Events.FireInformation(0, Nothing, String.Format("Upload failed: {0}", vErrMsg), Nothing, 0, fireAgain)
Next


I see that intellisense lists the following interested items under .Error such as:

.Data
.HelpLink
.InnerException
.Message
.Session
.Source
.StackTrace
.TargetSite

I am not sure which of these are WinSCP specific intended for logging errors and reporting file transfer failures.

I am using this in an SSIS VB.NET Script Task
Any help or examples with capturing errors would be greatly appreciated.