'How to delete pst file after deleting store using c#
I m removing the store and would like to delete the .pst file associated with it. I am developing a VSTO addin, where in once user logout then I would like to delete .pst file created for it. Again when user login, then will create new store and new .pst file associated with it.
Solution 1:[1]
PST provider keeps the PST file open for 30 minutes (or until the process terminates) for the performance and sharing purposes after it is removed from a profile.
You might want to play with the registry key mentioned in https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/222328 to make sure the file is closed sooner.
If this is a temporary PST file that the end user does not necessarily need to see, you can create an auxiliary exe that processes the PST. After the process exits, the PST file can be deleted. Note that you would need to use Extended MAPI (C++ or Delphi only) or Redemption (I am its author - any language, use RDOSession.LogonPstStore
) as the Outlook Object Model calls would still be marshalled back to the outlook.exe address space where your addin is running.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |