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 unmounts the pst. After unmounting the pst, I delete that file.
Now the problem is that even after un mounting the pst and releasing memory, when I try to delete the pst, I get an exception that some process is using this file so it can not be deleted. And that process is outlook. I am using following code to un mount and release memory:
_application.Session.RemoveStore(_personalFolder);
while (System.Runtime.InteropServices.Marshal.ReleaseComObject(_personalFolder) >= 0) ;
_personalFolder = null;
I checked it many times and it seems as if it takes some time to release memory and there is no definite time for this. Could any one help me how to delete the file?