File Watcher Task Manager. How to Make it Work?
I just downloaded the File Watcher Task, from here: http://www.sqlis.com/post/file-watcher-task.aspx I am now trying to test it to understand the functionality better. My understanding is that if a file shows up in a folder, a condition (True) is met, and the File Watcher Task will manage some task (I’m trying to get it to send me an email when a file is placed in a folder). Do I have the concept right? Is this the functionality of this tool? I set the conditions in the ‘File Watcher Task Editor’, and I just tried putting a file in a folder; see screen shots. Nothing happened. Any idea on what I did wrong, or what I need to do to make this work? Thanks everybody!!!
December 21st, 2011 10:07am

Seems the condition was not met for the event to fire. Can you post the image of the File Watcher task Editor setup?Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
December 21st, 2011 11:31am

I see what is happening! You have to run the ’File Watched task’ THEN add the file to the folder. Before, I had the file in the folder, and THEN started the task (it’s actually the other way around). So, the only issue now is sending the email. I don’t believe the ‘Send Mail Task’ works with the Gmail client. So, I created a ‘Script Task’ and followed the instructions here: http://consultingblogs.emc.com/jamiethomson/archive/2006/07/03/SSIS_3A00_-Sending-SMTP-mail-from-the-Script-Task.aspx I’m in VB, using this: Public Sub Main() ' Add your code here Dim myHtmlMessage As MailMessage Dim mySmtpClient As SmtpClient myHtmlMessage = New MailMessage("MyPersonalEmailAddress@gmail.com", " MyPersonalEmailAddress@gmail.com", "Subject", "body") mySmtpClient = New SmtpClient("smtp.gmail.com") mySmtpClient.Credentials = CredentialCache.DefaultNetworkCredentials mySmtpClient.Send(myHtmlMessage) 'Dts.TaskResult = Dts.Results.Success Dts.TaskResult = ScriptResults.Success End Sub Everything seems to compile fine, so I save it and run the process. File Task Watched turns green and Script Task turns red. Here is the syntax from the Output window. SSIS package "Package.dtsx" starting. Error: 0x1 at Script Task: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 74.125.93.108:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at ST_05dd7b94f117426e95c76b18764d235b.vbproj.ScriptMain.Main() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript() Task failed: Script Task Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. SSIS package "Package.dtsx" finished: Failure.
December 21st, 2011 12:03pm

The mail server you're attempting to send the mail to doesn't want it. At least not from "defaultnetworkcredentials", anyway. The gmail server may be wanting you to provide google credentials to it. Google likely has some information about how to connect to its SMTP server with .Net - search that down. Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
December 21st, 2011 12:19pm

Ah! Thanks for the push. I found the solution here: http://social.msdn.microsoft.com/Forums/en/sqlintegrationservices/thread/990bbaa2-bc49-44e5-a8fc-534116a94a21 For those too lazy to click the link, this is it: Dim myHtmlMessage As MailMessage Dim mySmtpClient As SmtpClient myHtmlMessage = New MailMessage("FromEmail@gmail.com", "ToEmail@yahoo.com", "You have a new registration!", "This is only a Test!") mySmtpClient = New SmtpClient("smtp.gmail.com") mySmtpClient.Credentials = New System.Net.NetworkCredential("FromEmail@gmail.com", "MyPassword") mySmtpClient.EnableSsl = True mySmtpClient.Port = 587 mySmtpClient.Send(myHtmlMessage) It totally makes sense to include a Password and a Port in the code; I had neither before. LOL!!!! I have to say, this is F*&$!^G cool!!!
December 21st, 2011 12:46pm

Thanks so much.
Free Windows Admin Tool Kit Click here and download it now
June 21st, 2012 3:19pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics