Send Mail Task - Building expression for ToLine property - getting error code 0xC00470D0

  • Resolution to the issue below:

    The Foreach Loop Container needed a new user "string" variable setup to which the source object variable (User::SurveyEmails) to could map to. This was done in the Foreach Loop Editor on the Variable Mappings page. I was then able to add a ToLine property expression on the Send Mail Task and map the new string variable to it.

    *********************************************************************************

    I am creating a package that will send an email to each address that's selected from a table. I’m trying to accomplish this with the use of the Execute SQL Task and the Send Mail Task inside of a Foreach Loop Container (the SQL Task is outside of the loop). I have setup a Full Result Set User Object Variable (I called it User::SurveyEmails) to which the SQL Task stores selected email addresses.

    On the Send Mail Task, I wanted to setup a ToLine property expression and assign the value from the user variable (User::SurveyEmails). However, it appears that a user variable is not supported in an expression (or at least not in my case). When I evaluate the expression, I get the following error.

    "The data type of variable "User::SurveyEmails" is not supported in an expression.

    Reading the variable "User::SurveyEmails" failed with error code 0xC00470D0."

    On the container itself, I setup the following:

    ***Collection tab***

    1) Foreach Loop Editor Enumerator = Foreach ADO Enumerator

    2) ADO object source variable = User::SurveyEmails

    3) Checked radio button for "Rows in the first table"

    ***Variable mappings tab***

    Contains the Variable "User::SurveyEmails" with an index of "0".

    ***Expressions tab***

    There are no expressions.

    Does anyone have any ideas on how I can accomplish what I’m needing to do? Or if you have some insight on what I may be doing wrong, that would be greatly appreciated. Thanks

  • Libby,

    In your Execute SQL Task; do you have your object variable listed in the Result Set section assigned to Result Name 0?

    When you output a SQL task to a variable (of type object) that variable can only be read in certain ways. The most successful for me has always been a For Each Loop as you have set up. I would configure things as you have them, but inside of your For Each Loop you will set the the following:

    1. ADO object source variable = User::SurveyEmails

    2. In Variable Mappings you will set the variable for Index 0 to a NEW variable you create that should be of type STRING.

    Then use your new variable in your expression. I think the problem is you are tryign to use your object variable. Basically you want the object variable to be the ADO object source variable, and you need a different variable of type string that the For Each Loop will populate with your email addresses as it loops through.

    Hope this helps.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply