Question Outlook seems to interfere with FileSystemWatcher

cblack

Member
Joined
Oct 24, 2015
Messages
5
Programming Experience
1-3
I'm learning how to use FileSystemWatcher in C# and I'm following the example here:

https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher%28v=vs.110%29.aspx


I'm not sure what is happening but when I rename a file, for example, FileSystemWatcher occasionally reports that it's in the "../Documents/Outlook 2007" directory (where I have the .pst file) when clearly it is not. Is this because I've got Outlook open at the time. How can I stop FileSystemWatcher doing that? Should I use a query with e.OldFullPath to make sure if the old file name is in that directory first or would that use up too much system resources?

I'm using Visual Studio Community 2013 on Windows 8.1 and I've got Outlook 2007.

Thanks.
 
I just noticed a variable called _folder was declared as:

public String _folder { get; private set; }


Could that have been the reason why the wrong folder was listed for that file? I've changed it to a private variable, ie

private String _folder = "";


I've got the FileSystemWatcher instantiated as two objects, one watching the Documents directory (where the .pst file for Outlook is kept) and the other watching the Desktop.
 
Last edited:
Back
Top Bottom