We have BPMs in various places that create a sysconfig shortcut file and attach it to an email. They work fine in 2021.2 but after upgrading to 2022.2 we are seeing this error when trying to compile them. Any idea how to rewrite this?
And the error is:
System.Drawing.Bitmap CS1503 Argument 2: cannot convert from ‘System.Collections.Generic.Dictionary<string, string>’ to ‘System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, System.IO.Stream>>’
I’m thinking the same as @utaylor , maybe they deprecated that method you are using. I’ve done an attachment using a dictionary<string, stream> , maybe that will still work on your version.
Thanks for the suggestions so far, I’ll see if I can rewrite this. I really didn’t want to waste time trying to figure this out, knowing that Epicor now supports linking, but we are still using the classic screens for these objects. Sigh.
Sorry to necropost, just wanted to post this for anyone searching later.
I tried using Dictionary<string,Stream> for my attachments as @Asz0ka and @utaylor suggested, but had trouble adding multiple attachments. I’m able to use a Dictionary<string, byte[]> and it works in Kinetic 2023.1 and Epicor 10.2.700
using ( var mailer = new Ice.Mail.SmtpMailer(this.Session) ) {
using ( var message = new Ice.Mail.SmtpMail() ) {
string sendFrom = (string)Db.SysCompany.Where( x => x.Company == callContextClient.CurrentCompany).FirstOrDefault().EmailFromAddr;
string DisplayName = "Your Display Name Here";
if ( displayName.Length > 0 )
sendFrom = $"{displayName} <{sendFrom}>";
message.SetFrom(sendFrom);
message.SetTo("recipient@email.com");
message.SetCC( "CC@email.com; cc2@email.com" );
message.SetSubject("Subject");
message.SetBody("Body");
message.IsBodyHtml = false;
var attachments = new Dictionary <string,byte[]>();
attachments.Add( "fileName0.csv", System.IO.File.ReadAllBytes( @"C:\Path\To\File0.csv" ) );
attachments.Add( "fileName1.csv", System.IO.File.ReadAllBytes( @"C:\Path\To\File1.csv" ) );
mailer.Send( message, attachments );
}
}