How we can copy a file from one server to another server inside a workflow4 .10 - 4.13?
Hi All,
Wonder if everyone did similar thing before - to copy a file from one server to another server by UNC path inside a workflow? For example, there is a file on \\server1\folder\1.pdf, and I wanted to make a copy to server 1 on folder F:\Drawings\. I could not find activity which can do this. Your idea or experience are greatly appreciated!
All the best,
Steven
0
-
One option would be to use the Read File Bytes activity, followed by Write File.
If the file is large, this may have memory issues, so alternatively you could use the Invoke Method activity with Target Type set to System.IO.File, and Method Name set to Copy. Add two parameters of type String that contain the source and destination filename respectively. (There's an overload that takes a third parameter that allow you to overwrite the target file if it already exists, see https://docs.microsoft.com/en-us/dotnet/api/system.io.file.copy?view=netframework-4.5 )0 -
HI Berend, Thanks so much for your input!
I was trying to use Invoke Method activity with Target Type set to System.IO.File, and Method Name set to Copy, however, it threw error " File doesnot have a public static method named 'copy" matching the parameter types, generic type arguments, and generic type constraints supplied to InvokeMethod.'InvokeMethod. I also tried to add two parameters to include the source and destination in copy (source, destination), but same error.
It will be so appreciated if you could shed some lights on it. Thanks0 -
To add parameters, you need to click the … button for the Parameters option of the Invoke activity. It's in the window on the right. 0 -
Getting closer! I can copy over a file using InvokeMethod where the source and destination are on the same server. but got error " user name or password is not correct"when the source file is on a UNC path (another server). 0 -
Well, the user that's configured for the Geocortex apppool (in IIS) should have write privileges on that UNC path. By default, this user is a local user on the machine where Geocortex is installed, and will in most cases not have access to shared folders. You may have to configure a domain user for the apppool. 0
Please sign in to leave a comment.
Comments
5 comments