Can FileSystemWatcher work offline?

I wrote an application that should track changes in a synchronized offline folder until the user is connected to the network. I used FileSystemWatcher, and it works great while the user is connected to the network, however, as soon as they are offline, FileSystemWatcher stops receiving any events.

I cannot find documentation on file system events in offline folder mode, does anyone have any experience in this space?

thanks

+4
source share
2 answers

http://www.codeproject.com/Articles/15656/Advanced-FileSystemWatcher

  • two new open events: NetworkPathAvailable and NetworkPathUnavailable. In the code, the user will search in these events to determine if the network path is available, and the code can take appropriate measures to continue working or die correctly. *
0
source

When the user goes offline, Win32Error enters FileSystemWatcher with the error message "The specified network name is no longer available." This can be detected in the FileSystemWatcher.Error event.

This exception also affects the setting of the EnableRaisingEvents property to false. After the user connects to the network again, set this to true again, and you will receive notifications again. Unfortunately, you will not be notified of what happened when the user was offline.

So, the final answer to your question is no, FileSystemWatcher does not notify an offline file.

0
source

All Articles