SSIS SMTP Initilise ERROR using Expressions When calling SSIS from Dotnet
Error occurs only if calling SSIS from dotnet "Microsoft.SqlServer.Dts.Runtime", when using expressions to set SMTP server name, SMTP from address and SMTP to Address .
Error Massage: The result of the expression "@[User::SMTP_ServerName]" on property "SmtpServer" cannot be written to the property. The expression was evaluated, but cannot be set on the property.
If calling SSIS from commandLine, no error.
Upvotes: 0<=-=Apr 20 2006 2:52PM=-=>
Not able to repro. Able to execute a Send Mail Task in a dot net application when passing the SMTP Server as an expression
The dtsx package is configure:
1) Create a Variable SMTPServer string
2) Create a Send Mail task with valid To, From and Subject
3) Create a CM to a valid SMTPServer
4) Click in the CM manager and from properties\expressions select Connection String with expression @[User::SMTPServer] (Drag and drop the variable value)
Save the dtsx package
Then using a C# application with Microsoft.SqlServer.Dts.Runtime;
string pkg = @"g:\SSIS_SendMailTask.dtsx";
Application app = new Application();
Package p = app.LoadPackage(pkg, null);
I am also getting this error when running packages from an ASP.Net web app using Microsoft.SqlServer.Dts.Runtime. The error occurs when using expressions on the Send Mail task, e.g. CCLine, ToLine.
Send Mail Task _ The result of the expression “@[Config::Email_Cc]” on property “CCLine” cannot be written to the property. The expression was evaluated, but cannot be set on the property.<=-=Mar 11 2009 2:53AM=-=>
Note that the Microsoft comment above is describing setting expression on the connection manager. The problem occurs when setting the expressions on the Send Mail task.