Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Re: VB.NET parameter issues of function: session.SynchronizeDirectories()

For a simple inline syntax, you can also use:
options:=New TransferOptions With { .OverwriteMode = OverwriteMode.Overwrite }
woodfor

VB.NET parameter issues of function: session.SynchronizeDirectories()

Platform: Visual Studio 2017
language: VB.NET
source: NuGet
Version of WinSCP: 5.13.6
protocol: FTP

I was trying to enable some transfer options and my code is like this
Dim synchronizationResult As SynchronizationResult

    synchronizationResult = session.SynchronizeDirectories(
                        SynchronizationMode.Remote,
                        localFolderPath,
                        targetFolderPath,
                        True,
                        criteria:=SynchronizationCriteria.Either,
                        options:=OverwriteMode.Overwrite)


However the complier reports:
Error BC30311: Value of type 'OverwriteMode' cannot be converted to 'TransferOptions'.
After looking up the definiton of "TransferOptions", I found that it is a class:
Public NotInheritable Class TransferOptions

        Public Sub New()

        Public Property PreserveTimestamp As Boolean
        Public Property FilePermissions As FilePermissions
        Public Property TransferMode As TransferMode
        Public Property FileMask As String
        Public Property ResumeSupport As TransferResumeSupport
        Public Property SpeedLimit As Integer
        Public Property OverwriteMode As OverwriteMode
    End Class


The initializer is empty and lack "End sub". I am unable to initial property and pass valid argument as I even tried
options:= new TransferOpions(OverwriteMode.Overwrite)

I am not familiar with VB.NET. Could you please help me out?