Topic "SynchronizationResult "Unknown name""

Author Message
bobmcrae
[View user's profile]

Joined: 2015-03-06
Posts: 5
Location: United States
I am new to the use of the .NET assembly, but finding it incredibly better than scripting. However, I am having difficulty getting the results of a synchronization, which is actually succeeding. I'd like to see what files are transferred, but cannot seem to iterate through the SynchronizationResult. I am getting a COM error "Unknown name" for everything I have tried.

Perhaps I am misunderstanding that SynchronizationResult has a TransferEventArgsCollection that I can iterate through to get the .FileName of each transferred file. I'd appreciate clarity on the proper method.

I am using AutoIT and here is the code snippet causing issues:
; this works
$syncResult = $session.SynchronizeDirectories($syncMode, $localDir, $remoteDir, False)
If Not $syncResult.IsSuccess Then
SetError(-5)
Return False
EndIf

; here is where I am getting the COM error "Unknown name" for the $syncResult.Transfers object
; I have tried $syncResult.TransferEventArgsCollection, but that results in the same thing
For $transferItem in $syncResult.Transfers
ConsoleWrite($transferItem.FileName & @CRLF)
Next


Thanks in advance.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
There's indeed no .Transfers property in SynchronizationResult.

There are .Uploads and .Downloads.
See http://winscp.net/eng/docs/library_synchronizationresult
bobmcrae
[View user's profile]

Joined: 2015-03-06
Posts: 5
Location: United States
Using Uploads I was able to see that the COM error is avoided and I get the result I was looking for. Thank you.

I am coming at this as a beginner, so I was confused by the documentation, which lead me to believe that the
SynchronizeDirectories object returned a SynchronizationResult object which returned TransferEventArgsCollection (an object). I see now under TransferEventArgsCollection, is listed Uploads (and Downloads). However, can you help me (and others) understand at what point I use the object versus the test result (Uploads)?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
bobmcrae wrote:
which lead me to believe that the
SynchronizeDirectories object returned a SynchronizationResult object

That's correct.

Quote:
which returned TransferEventArgsCollection (an object). I see now under TransferEventArgsCollection, is listed Uploads (and Downloads).

The TransferEventArgsCollection is a type of .Downloads and .Uploads properties of SynchronizationResult result class/object.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License