I have a Unit Test project that makes use of Interop.ADODB
. Here is the code:
public CDO.Message ReadMessage(string emlFileName)
{
if (string.IsNullOrEmpty(emlFileName)) return null;
CDO.Message msg = new CDO.MessageClass();
ADODB.Stream stream = new ADODB.StreamClass();
stream.Open(Type.Missing,
ADODB.ConnectModeEnum.adModeUnknown,
ADODB.StreamOpenOptionsEnum.adOpenStreamUnspecified, string.Empty, string.Empty);
stream.LoadFromFile(emlFileName);
stream.Flush();
msg.DataSource.OpenObject(stream, "_Stream");
msg.DataSource.Save();
return msg;
}
The problem is that I converted this project to .NET Core. I cannot figure out how to import the COM libraries that I need to make this method works. The ones that I need are Interop.ADODB
and Interop.CDO
.
All this method does is takes an email file and converts to the object so that I may read the values out of it and then compare to the email that was sent. Really a simple unit test to validate email contents.
Is there a way for me to import COM objects or is there a library that replaced CDO.Message
that I am suppose to use now?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…