BizTalk: Delete Spam at Target Location Using File Adapter
A client of mine sometimes receives spam messages in their BizTalk file folders, that is, files not of the type expected by the recipient location filter, such as .doc instead of .xls. The file adapter does not have the ability to remove such junk - perhaps for a good reason, and we cannot prevent the sender of these files from sending them occasionally.
My solution was to use a scheduled task to periodically run a powershell script that moves all files that don't match the recipient location filter to a folder where the user can check files and delete any "spam" "thus preventing folders from filling up.
Is there a better way to achieve this?
To be honest, you've come up with the simplest solution for quite some time now :) There was nothing in BizTalk that would really help you avoid this problem, so any other options include adding custom code for it.
For example, you can customize the receiving location for file selection (.) And then create a custom pipeline component that discards unwanted messages.
a source to share
Thanks.
If "files" is the biztalk folder and "spam" is the spam folder, then this PowerShell line moves all non-csv files from the files folder to the spam folder.
dir files -path -exclude * .csv | spam process move-item -dest
This is then done by saving to a powershell script and run through the Windows System Task Scheduler.