First off, I am not a c# person, so please bear with me on this one. I need to replace the occurrences of "D:" with "d$" on a script task within SSIS. I sure use the replace function to do this, but the problem is, that this is having unintended consequences on another line.
For example, the script task sends out an email and the header of the email reads as \servername\d$ \further_path. The body of the email reads "UID: 1 : MESSAGE"
The line of code that sends the email reads like:
myHtmlMessage = new MailMessage(Dts.Variables["MailFromAddress"].Value.ToString(), Dts.Variables["MailRecipients"].Value.ToString(), Dts.Variables["MailSubjectSuccess"].Value.ToString(), Dts.Variables["MailBodySuccess"].Value.ToString().Replace("D:", @"\d$ "));
The current output that I get is:
Server Start Time: 3/21/2017 7:25:33 AM
Server End Time: 3/21/2017 7:27:39 AM
Total Run Time: 00:02:06.9402516
Log Folder: \\ServerNamed$\Apps\SSIS\Logs\
UId$ 2 -
The intended output is:
Server Start Time: 3/21/2017 7:25:33 AM
Server End Time: 3/21/2017 7:27:39 AM
Total Run Time: 00:02:06.9402516
Log Folder: \\ServerNamed$\Apps\SSIS\Logs\
UID: 2 -
Look at the log folder line and the UID line
When I use the replace function, the body line gets affected as well with the d$ symbol and that is what I am trying to avoid. Can I write a conditional REPLACE function in C# or, is there any other way to deal with this?
Thanks, RV.