28-04-22 08:35 PM
29-04-22 09:49 AM
29-04-22 10:04 AM
30-01-26 10:12 AM
Hi @WilliamHillman ,
Were you able to resolve this issue?
I am trying to use this VBO, and I am facing this same issue.
If you have any suggestions, please let me know.
Thanks,
Varad
30-01-26 12:02 PM
i already built re-usable object to work with SFTP , i can share the entire object, you have to paste that DLL in Blueprism automate folder
30-01-26 12:15 PM
Below code will list files from SFTP to collection, you have to specify username , password , host and port number
note: below xml code is an action page from object. you can copy this paste directly in object, it will create new page with name called List Files.
here is the code option page, once you paste that DLL in blueprism automate folder, add below name spaces
all these actions you can do
<process name="__selection__RPA - Utility - SFTP" type="object">
<subsheet subsheetid="7072573e-ce65-428e-b6d8-d0b802ccf618" type="Normal" published="True">
<name>List Files</name>
<view>
<camerax>0</camerax>
<cameray>7</cameray>
<zoom version="2">1.25</zoom>
</view>
</subsheet>
<stage stageid="4636b57e-91ad-47c7-81e5-b4a3bd7d55c6" name="List Files" type="SubSheetInfo">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<narrative>Set Variables - call me first</narrative>
<display x="-195" y="-105" w="150" h="90" />
</stage>
<stage stageid="902ae425-a39a-44b0-aba7-2b79c266859e" name="Start" type="Start">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<narrative>Execute's command on remote server using SSH</narrative>
<display x="75" y="-105" />
<inputs>
<input type="text" name="Host" narrative="Hostname or IP address of the remote server" stage="Host" />
<input type="text" name="Username" narrative="Username for the remote server login" stage="Username" />
<input type="password" name="Password" narrative="Password for the remote server login" stage="Password" />
<input type="text" name="Private Key FilePath" narrative="Private Key FilePath stored locally" stage="Private Key FilePath" />
<input type="number" name="Port" narrative="sepecial port, if needed. Defaults to 22" stage="Port" />
<input type="text" name="Remote Directory" narrative="Directory path on remote server" stage="remoteDirectory" />
</inputs>
<onsuccess>c9ea7f46-494a-45ba-9773-d9dc82fa0626</onsuccess>
</stage>
<stage stageid="95a4afa9-0a1c-440d-8673-d5dc958b0db9" name="End" type="End">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<narrative>End of action</narrative>
<display x="75" y="45" />
<outputs>
<output type="flag" name="Success" stage="Success" />
<output type="text" name="ErrorMessage" stage="ErrorMessage" />
<output type="collection" name="fileList" stage="fileList" />
<output type="number" name="fileListCount" stage="fileListCount" />
</outputs>
</stage>
<stage stageid="3e0167a4-5a08-492d-8e3c-f215f91ff344" name="Input Data Items" type="Block">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<display x="-300" y="30" w="210" h="60" />
<font family="Segoe UI" size="10" style="Regular" color="FFCC00" />
</stage>
<stage stageid="25de69a1-76d5-4047-b3a9-176970bb089a" name="Local Data Items" type="Block">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<display x="-300" y="-45" w="210" h="60" />
<font family="Segoe UI" size="10" style="Regular" color="339966" />
</stage>
<stage stageid="18867604-cb05-4d55-8a4b-7b85f5e46388" name="Output Data Items" type="Block">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<display x="-300" y="105" w="210" h="105" />
<font family="Segoe UI" size="10" style="Regular" color="993300" />
</stage>
<stage stageid="c9ea7f46-494a-45ba-9773-d9dc82fa0626" name="List Files" type="Code">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<narrative>Deletes file from remote directory</narrative>
<display x="75" y="-30" />
<inputs>
<input type="text" name="Username" expr="[Username]" />
<input type="text" name="Host" expr="[Host]" />
<input type="text" name="keyLocation" expr="[Private Key FilePath]" />
<input type="password" name="Password" expr="[Password]" />
<input type="number" name="Port" expr="[Port]" />
<input type="text" name="remoteDirectory" expr="[remoteDirectory]" />
</inputs>
<outputs>
<output type="flag" name="Success" stage="Success" />
<output type="text" name="ErrorMessage" stage="ErrorMessage" />
<output type="collection" name="fileList" stage="fileList" />
<output type="number" name="fileListCount" stage="fileListCount" />
<output type="collection" name="dFileList" stage="dFileList" />
</outputs>
<onsuccess>95a4afa9-0a1c-440d-8673-d5dc958b0db9</onsuccess>
<code><![CDATA[
Dim sftpClient as SftpClient = Nothing
Dim files As New DataTable()
Dim dt as New DataTable()
dt.Columns.Add("Name")
dt.Columns.Add("FullName")
dt.Columns.Add("Size")
dt.Columns.Add("LastWriteTime")
Try
Success = True
ErrorMessage = ""
Dim connectionInfo As ConnectionInfo
connectionInfo = getConnInfo(Host, Port, Username, Password, keyLocation)
sftpClient = New SftpClient(connectionInfo)
sftpClient.Connect()
files = listFiles(sftpClient, remoteDirectory)
fileList = files
fileListCount = files.Rows.Count
dim dFiles = sftpClient.ListDirectory(remoteDirectory)
for each f in dFiles
if f.Name <> "." AndAlso f.Name <> ".." then
dt.Rows.Add(f.Name, f.FullName, f.Length.ToString(), f.LastWriteTime.ToString())
end if
next
dFileList = dt
sftpClient.Disconnect()
Catch Ex As Exception
Success = false
ErrorMessage = Ex.Message
End Try
]]></code>
</stage>
<stage stageid="f044e792-a0a3-48ae-9ecb-0bb5daca84c9" name="ErrorMessage" type="Data">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<display x="-150" y="135" w="90" h="30" />
<datatype>text</datatype>
<initialvalue />
<private />
<alwaysinit />
</stage>
<stage stageid="16b7c632-6b23-450f-9423-917154f20971" name="Success" type="Data">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<display x="-240" y="135" w="90" h="30" />
<datatype>flag</datatype>
<initialvalue />
<private />
<alwaysinit />
</stage>
<stage stageid="9fd2b475-5c8f-41dd-a3af-f290a642a511" name="remoteDirectory" type="Data">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<display x="-210" y="60" w="120" h="30" />
<datatype>text</datatype>
<initialvalue xml:space="preserve">/yourmftservername/yourfoldername</initialvalue>
<private />
<alwaysinit />
</stage>
<stage stageid="f89c1f28-9d99-4e4b-bbf1-01ad7d494065" name="fileList" type="Collection">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<display x="-240" y="180" w="90" h="30" />
<datatype>collection</datatype>
<private />
<alwaysinit />
</stage>
<stage stageid="14fa74aa-28ca-4325-ae56-cf25483a4b88" name="fileListCount" type="Data">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<display x="-150" y="180" w="90" h="30" />
<datatype>number</datatype>
<initialvalue>0</initialvalue>
<private />
<alwaysinit />
</stage>
<stage stageid="e2c659cc-ac66-4603-b0bb-5925ad5559b9" name="dFileList" type="Collection">
<subsheetid>7072573e-ce65-428e-b6d8-d0b802ccf618</subsheetid>
<loginhibit onsuccess="true" />
<display x="150" y="-30" />
<datatype>collection</datatype>
<private />
<alwaysinit />
</stage>
</process>
30-01-26 12:19 PM