M
matt dittman
I have created a windows service that reads emails from a
drop directory and moves them to the appropriate mail
folder every 15 seconds. I can move, rename and delete
the files as needed, up until the
CDO.DropDirectory.GetMessages() method is called. At
this point, the files are locked until I shut down the
service. After processing and delivery, I need to be
able to delete all the files in the drop directory.
I can delete them via Windows Explorer, but when using my
C# service and the DropDirectory.GetMessages().DeleteAll
() method I receive the error "One or more messages could
not be deleted" and none of the messages are deleted.
Attempts to use other methods to delete the files, such
as FileInfo objects, also result in no file deletion and
errors being thrown.
However, when I shut down the service, it does finally
clear out the folder. It seems like the CDO object only
marks the files for deletion and locks them until it can,
which seems to be only when the CDO object is permanently
destroyed. Is there any way to force the CDO object to
immediately DeleteAll() messages?
drop directory and moves them to the appropriate mail
folder every 15 seconds. I can move, rename and delete
the files as needed, up until the
CDO.DropDirectory.GetMessages() method is called. At
this point, the files are locked until I shut down the
service. After processing and delivery, I need to be
able to delete all the files in the drop directory.
I can delete them via Windows Explorer, but when using my
C# service and the DropDirectory.GetMessages().DeleteAll
() method I receive the error "One or more messages could
not be deleted" and none of the messages are deleted.
Attempts to use other methods to delete the files, such
as FileInfo objects, also result in no file deletion and
errors being thrown.
However, when I shut down the service, it does finally
clear out the folder. It seems like the CDO object only
marks the files for deletion and locks them until it can,
which seems to be only when the CDO object is permanently
destroyed. Is there any way to force the CDO object to
immediately DeleteAll() messages?