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

AlainC

Solved...

I found the solution in another post in the ".NET & COM Library" (which didn't show up with the search, or better, didn't notice it).

The filepermissions seems to be set first, befor assigning..

So i.s.o.
transferOptions.FilePermissions.GroupWrite = True

I needed
Dim fp As New FilePermissions

fp.GroupWrite = True
transferOptions.FilePermissions = fp


Well, actually, as the new Filepermissions is empty, I actually used "fp.Numeric = 438 'oct 666"
AlainC

Set transferOptions.FilePermissions via VB (Express)

As the subject says, I want to change the filepermissions - for the files to be transferred - via a script, and I always receive an error when I try to set the parameter.

The error: Object reference not set to an instance of an object.

Is this a bug, or what am I missing?

Part of the script (which works, as long as don't use the line transferOptions.FilePermissions.GroupWrite = True
Using session As Session = New Session

 ' Connect
 session.Open(sessionOptions)

 ' Upload files
 Dim transferOptions As New TransferOptions
 transferOptions.TransferMode = TransferMode.Ascii
 
 '******** The line below generates an error ***********
 transferOptions.FilePermissions.GroupWrite = True

 Dim transferResult As TransferOperationResult
 transferResult = session.PutFiles(path_orig, strUploadDirRemote, False, transferOptions)

 ' Throw on any error
 transferResult.Check()

 ' Print results
 Dim transfer As TransferEventArgs
 For Each transfer In transferResult.Transfers
   Me.RTbox.AppendText("Upload of '" & transfer.FileName & "' succeeded" & vbCrLf)
 Next
End Using


There is also a try/catch, but this isn't given in in the code, I also updated to the latest version (5.1.7), but it doesn't make a difference