3
votes

I'm attempting to use the send-mail task to send a message upon the successful completion of a data-flow task.

When the package is executed, an error is generated:

Error: Failed to lock variable "The extraction was successful.

PROPERTIES

Starting: 10/27/2015 Ending: 10/27/2015 11:59:59 PM Records: 207 " for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

The send-mail task's MessageSourceType is set to Variable.

The expression assigned to the send-mail task's MessageSource property:

"The extraction was successful.\n\n" +
"PROPERTIES\n" +
"----------\n\n" +
"Starting: " + (DT_WSTR, 50) @[$Project::StartingDateTime] + "\n" + 
"Ending: " + (DT_WSTR, 50)  @[$Project::EndingDatetime] + "\n" + 
"Records: " + (DT_WSTR, 50) @[User::OriginalRecords] + "\n"

The User::OriginalRecords variable is being (correctly) populated by a row-count task.

What am I doing wrong?

1
Are you trying to access the variable somewhere in the data flow, like a script component task? - sorrell
The User::OriginalRecords is set in a data flow, but not used there (in a script component). - craig

1 Answers

3
votes

I need to set the send-mail task's MessageSourceType is set to Direct Input. Credit.