The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
agent09
3 years agoNew Contributor II
Business Rule for SFTP
Hi - we're trying to PULL files from an SFTP server. These will be used for our OneStream load.
Are there any sample BRs that we can reference to facilitate the file transfer from the SFTP server t...
NicolasArgente
3 years agoValued Contributor
https://winscp.net/eng/docs/library#vbnet
Imports WinSCP
Friend Class Example
Public Shared Function Main() As Integer
Try
' Setup session options
Dim sessionOptions As New SessionOptions
With sessionOptions
.Protocol = Protocol.Sftp
.HostName = "example.com"
.UserName = "user"
.Password = "mypassword"
.SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
End With
Using session As New Session
' Connect
session.Open(sessionOptions)
' Upload files
Dim transferOptions As New TransferOptions
transferOptions.TransferMode = TransferMode.Binary
Dim transferResult As TransferOperationResult
transferResult =
session.PutFiles("d:\toupload\*", "/home/user/", False, transferOptions)
' Throw on any error
transferResult.Check()
' Print results
For Each transfer In transferResult.Transfers
Console.WriteLine("Upload of {0} succeeded", transfer.FileName)
Next
End Using
Return 0
Catch e As Exception
Console.WriteLine("Error: {0}", e)
Return 1
End Try
End Function
End ClassUS
1 year agoNew Contributor III
Hi Nicolas - Do you have a sample business rule that uses SSH Keys for authentication instead of a password?
Related Content
- 2 years ago
- 3 years ago
- 4 years ago