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

Advertisement

woodfor
Guest

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?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
31,266
Location:
Prague, Czechia

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 }

Reply with quote

Advertisement

You can post new topics in this forum