This project is read-only.

Trying to watch networked folder.

Jul 19, 2016 at 4:59 PM
I am hoping to watch a networked folder using SmartWatcher. From what I've read online this should be possible (albeit with some issues):

However after reading through the source code, it seems like the SmartWatcher cannot handle this. I added my own code in order to connect using PInvoke Windows Networking at the beginning of the RegisterWatchers() functions. I have tested my code in a seperate console app and found that it is able to copy/paste to a networked folder, however if seem that this throws errors in the SmartWatcher app. The log code is as follows:
2016-07-19 10:48:14,842 [1] DEBUG -      [SmartWatcherLogger] Start Debugging.
2016-07-19 10:48:14,851 [1] INFO  -      [SmartWatcherLogger] LoadPlugIns() - Start
2016-07-19 10:48:14,863 [1] INFO  -      [SmartWatcherLogger] Register(IPlugin plugin) - Start
2016-07-19 10:48:14,863 [1] INFO  -      [SmartWatcherLogger] plugin name:Plugin2
2016-07-19 10:48:14,863 [1] INFO  -      [SmartWatcherLogger] Register(IPlugin plugin) - Finish
2016-07-19 10:48:14,863 [1] INFO  -      [SmartWatcherLogger] Add plugin, plugin name:Plugin2
2016-07-19 10:48:14,873 [1] INFO  -      [SmartWatcherLogger] Register(IPlugin plugin) - Start
2016-07-19 10:48:14,873 [1] INFO  -      [SmartWatcherLogger] plugin name:SW_NetworkedFolder_Plugger1
2016-07-19 10:48:14,873 [1] INFO  -      [SmartWatcherLogger] Register(IPlugin plugin) - Finish
2016-07-19 10:48:14,873 [1] INFO  -      [SmartWatcherLogger] Add plugin, plugin name:SW_Finch_Plugger1
2016-07-19 10:48:14,873 [1] INFO  -      [SmartWatcherLogger] LoadPlugIns() - Finish
2016-07-19 10:48:14,874 [1] INFO  -      [SmartWatcherLogger] RegisterWatchers() - Start
2016-07-19 10:48:14,875 [1] INFO  -      [SmartWatcherLogger] Watcher added, plugin name: Plugin2
2016-07-19 10:48:14,875 [1] INFO  -      [SmartWatcherLogger] RegisterWatchers() - Finish
2016-07-19 10:48:14,920 [1] INFO  -      [SmartWatcherLogger] Directory not exist, creating watching directory, directory name: \\networkedfolder\Username\Public\SmartWatcher\Source1
2016-07-19 10:48:15,478 [1] ERROR -      [SmartWatcherLogger] ConsoleThreadException, An application error occured. Please contact the administrator with the following information:

Error Message: Access to the path '\\networkedfolder\Username\Public\SmartWatcher\Source1' is denied.

Stack Trace:
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
   at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
   at System.IO.Directory.CreateDirectory(String path)
   at SmartWatcher.Services.SmartWatcherService.RegisterWatchers() in c:\projects\smartwatcher\smartwatcher\smartwatcherservice.cs:line 95
   at SmartWatcher.Services.SmartWatcherService..ctor() in c:\projects\smartwatcher\smartwatcher\smartwatcherservice.cs:line 155
   at SmartWatcher.Services.Program.Main() in c:\projects\smartwatcher\smartwatcher\program.cs:line 70
Is there any advice that can be given on how to accomplish watching a networked folder with SmartWatcher?
Jul 20, 2016 at 7:25 PM
So I have found the solution on my own. The service needs to be run with the proper permissions by default it logs in as Local Service. I solved it by setting it to log in as Local System instead. I modified this in the properties of the service from the Services application. However, this resets on re-installation, so I modified the installed to set up the service to log in as Local System instead.
Marked as answer by mpurnyn on 7/20/2016 at 11:25 AM