Limit on length of file attachment expression?

I'm dynamically attaching some files to an email. I'm using an expression to build something similar to this:

@[User::FilePath] + @[User::FileName1] + (DT_STR,30,1252)YEAR( GETDATE()) + (DT_STR,30,1252)MONTH( GETDATE()) + (DT_STR,30,1252)DAY( GETDATE()) + ".csv" + "|" + @[User::FilePath] + @[User::FileName2] + (DT_STR,30,1252)YEAR( GETDATE()) + (DT_STR,30,1252)MONTH( GETDATE()) + (DT_STR,30,1252)DAY( GETDATE()) + ".csv"

BOL says to use a pipe delimiter to send multiple attachments. This works if I only have a couple of files. Once I get a few more attachments built in the expression builder I get a truncation error. If I build the whole expression in notepad and past it into the property window it also gets truncated. I see in the MSDN library that some expressions may be limited to 4000 bytes. I'm nowhere near that. Maybe a thousand bytes at most.

Question 1: Does anyone know if certain expressions have smaller byte limits

Question 2: Is there a smaller byte limit for the file attachment value

Question 3: Is there way I could build this string outside of the file attachment property and assign it to a variable and then use this variable in the file attachment property

Thanks in advance for any help!!!

MarkAx



Answer this question

Limit on length of file attachment expression?

  • Eric Litovsky

    You can determine if this is the expression engine limit or the property limit by putting the expression on a variable. The property expression could just reference the variable. In fact just evaluating the expression in the Expression builder dialog should tell you if the expression and it's result is valid for the 4000 limit. If you need to test at runtime, then use a Script Task immediately before the Mail Task, that reads the variable (with your file list expression). The Script task read of the variable will force an evaluation, without any limitations of the attachment property.

    Q1 - None I know of.

    Q2 - Not documented, so should not be.

    Q3 - See above.



  • Limit on length of file attachment expression?