Hello Paul,
When I read your post I hear a chant for FileSystemWatcher in my head
The FileSystemWatcher class in the System.IO namespace can be used to monitor changes to the file system. It watches a file or a directory in your system for changes and triggers events when changes occur. FSW monitors for Changed, Created, Deleted, Error and Renamed events. Check out the Created event. You can find a Visual Studio C# FileSystemWatcher project that you can deploy as a service to test the functionality. You can define what file extension you will monitor for in the parent and also child folders
https://docs.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher?view=net-5.0Here is a gent trying to making it work in AX, but the problems he is experiencing is why I often will create a FSW service on a server doing the heavy lifting and let AX receive from the FSW service. Last time I did this in .Net I remember when my file was created on the server it spawned two Created event, not one. If you see his code is commented for the changed event and IIRC changed spawned 27 consecutive event.
https://philippsen.wordpress.com/2010/10/25/filesystemwatcher-problem-file-is-in-use-by-another-process/Enjoy, nice requirement
------------------------------
Bob Coward
Dynamics AX/F&O Developer
DSG
Grayson GA
------------------------------
Original Message:
Sent: Oct 12, 2021 09:20 AM
From: Paul Fildes
Subject: AX Class to monitor a network folder for a file
Hi all,
I have a need to develop a class in AX 2012 that will monitor a named network UNC folder for a CSV file that will be read and then moved to an archived folder. This class will run as a batch job, scheduled to run every hour.
Has anyone ever done this and can help me? Any pointers would be very much appreciated
Regards,
Paul
#AX2012 #Technical #Intermediate
------------------------------
Paul Fildes
AX Technical Support Consultant
Steelite International Ltd
Stoke-On-Trent
------------------------------