// Var : WshFileSystemObject Automation 'Windows Script Host Object Model'.FileSystemObject txtSrcFileName := TEMPORARYPATH + 'Source.txt'; // The file Source.txt does exists in the Temp Folder for the R2 server txtNewFileName := TEMPORARYPATH + 'Target.txt'; CREATE(WshFileSystemObject,TRUE, FALSE); // Created with Server Side Parameters IF WshFileSystemObject.FileExists(txtSrcFileName) THEN MESSAGE('Wsh File fonnd : %1', txtSrcFileName); // The message is shown, since the is fond on the Server
// Var : WshFileSystemObject Automation 'Windows Script Host Object Model'.FileSystemObject // FileHelper DotNet System.IO.File.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' txtSrcFileName := TEMPORARYPATH + 'Source.txt'; // The file Source.txt does exists in the Temp Folder for the NAV2013 Server CREATE(WshFileSystemObject,TRUE,TRUE); // Created with Client Side Parameters IF WshFileSystemObject.FileExists(txtSrcFileName) THEN MESSAGE('Wsh File Found : %1',txtSrcFileName); // The message is Never shown IF FileHelper.Exists(txtSrcFileName) THEN MESSAGE('DotNet File Found : %1',txtSrcFileName); // The message is Never shown
Comments
FileHelper : dotnet : System.IO.File.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Bool := FileHelper.Exists("you file") with RunOnClient properties = False
Avallack.
Maybe I miss something but.. if your file is on NAV2013 server why do you create your automation on Client?
Another question... which is the value of the property "RunOnClient" of your FileHelper variable?
It works as expected... More or Less...
But Since you create your Automations with RunOnClient = TRUE anyway this can't have worked previously on NAV2009, you explicitly instanciate the object on the client by yourself.
And last one: why don't you just use EXISTS() Function, it's always executed on the server, so this should give expected result.
Thanks for the answers they were very helpful.
The solution for me was to use the DotNet: System.IO.File.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and set the Property: RunOnClient=No. After that it all works fine.
Regarding the Creating of the Automation variable: WshFileSystemObject, the function CREATE() is changed in Nav2013 so it is only allow to create objects on the Client.
Once Again Thanks
Mikael Smith Larsen
You can use au dotnet var instead of automation ... it's has been method from Navision 2013