Problem in releasing memory from an Outlook pst file

前端 未结 1 1313
庸人自扰
庸人自扰 2021-01-24 08:47

I am working on a win app which accesses the Outlook personal folders. Internally, it mounts the personal folder on the Outlook instance and processes the mails and then unmount

1条回答
  •  盖世英雄少女心
    2021-01-24 09:16

    Have a look at KB234228 ("OL97: Outlook .pst File Lock Release Interval Now Configurable"). It is about Outlook 97, but I would guess that it still works.

    I guess that FileSystemWatcher will not help you, since there is no "exclusive lock released" event.

    So maybe you can make a worker thread, that continuously tries to delete all the .pst files you put in a queue. This way your application UI can at least go on uninterrupted.

    Tools like ProcMon do have the ability to look at the file handles of applications. Maybe you are able to make an API call that allows you doing that for the Oulook process (That's good material for another SO question, I guess). This way you don't have to poll the file system, and can act more quickly when the lock is gone.

    If you dare, you might even try and close the file handle in question right away, removing the need to poll/wait altogether.

    0 讨论(0)
提交回复
热议问题