dynamically assigning file name as an mail attachment

  • Hi all,

     

    Can you please send me code sample to dynamically assign file name - which I have to send as mail attachment.

    vcFilePath is the variable declared in SSIS which store network path

    vcFileName is the variable declared in SSIS which file name created and ready to be exported.

     

    I am using below statement (I am using VB.Net), but is not working.

    msg.Attachments.Add (vcFilePath & vcFileName)

     

    It will be very helpful if anyone can help me out with code samples or any help in this direction.

     

    Thanks in advance.

    Mohan

  • Not sure why you are using VB. Why not use the send mail task? You can then use an expression to add the attachment.

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • I understand we can do the same in expressitions. Since I am also having other business rules implemented in VB.Net, I would like to do email attachment in Vb.Net itself. I appreciate if anyone can guide me through. Thanks in adance.

  • Mohan, in order to get or set global variables in SSIS you must first set those variables in the script task to be ReadOnly or ReadWrite Variables in the task options, then you would need to call the pipeline from the script.  To use your example:

    msg.Attachments.Add (Dts.Variables("vcFilePath").Value.ToString & Dts.Variables("vcFileName").Value.ToString)

    Hope that helps.

    jim

  • Thanks for the help.

  • Can anyone point me in the right direction to understand the syntax needed to work with expressions to allow dynamic attachments?

    Thanks in advance

    Troy

Viewing 6 posts - 1 through 5 (of 5 total)

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