IF ISCLEAR(FileSystemObjL) THEN CREATE(FileSystemObjL); IF FileSystemObjL.FileExists(AttachPathL + AttachNameL) THEN FileSystemObjL.DeleteFile(AttachPathL + AttachNameL);It works just fine under my computer. I am able to delete files located on a local computer and somewhere in the network.
I do understand that -2147352567 is a general Exception that has occurred on the DeleteFile component. The best way to solve it is to attach Visual Studio, enable Exceptions and locate the error. However this is not an option because my client won't let me install Visual Studio and do debugging.This message is for C/AL programmers: An exception was raised in method DeleteFile. The OLE control or Automation server has returned error (HRESULT) -214735267. The component did not provide the exception description.
Answers
it' s simple, your code is correct using filesystemobject could access modify or change any file in network or local.
but you need to install COMDLG32.OCX (library for client application) in each client which using that code you made
some client which had visual studio installed not need to re-register it. but in end user client you must register it. no need
to download the library because it' s already in the system folder.. don' t forget to run regsvr32 'comdlg32.ocx' for 32 bit and
regsvr32 'syswow64 path\comdlg32.ocx' for 64 bit
Luc Van Dyck, at least native function does not have limitation to 98 characters. I will try your solution and report the results here, may be it will work out.
Thank you for your replies!
Thank you very much for your reply.
I used the native NAV functions EXISTS and ERASE. They didn't delete a file but at least they displayed a meaningful error message stating that a file cannot be deleted because it is used by another program.
I didn't told the whole story in my first message for this post. The task was to create a file using NAS, send it via E-mail using SMPT codeunit and then delete the file. I failed on the deletion step. It occurred that the cause of the error was NAV bug:
The bug can be fixed by KB 2280492.
After I implemented this KB to the client environment everything became fine and NAS hopefully started to delete files after sending them via e-mails.
So, once again, thank your for your valuables replied, they helped me to solve my issue!