Problem Using CAPICOM, CDOSYS and EXCEL Interop wi
Problems:
=========
1. If the attachment is an Excel file (zipped or
unzipped) generated in the app and is sent as secure mail
(S/MIME PKCS#7 encryption), the mail cannot be opened in
outlook - it says, "Your Digital Id can not be found by
the underlying security system". Works fine if the
attachment is a text file (zipped or unzipped).
2. When using CDO, the file(s) used as attachment are
locked and are not available for exclusive access (to be
deleted). If
System.Runtime.InteropServices.Marshal.ReleaseComO bjec()
is used to release the CDO object used, then any
subsequent call to .NET MailMessage object fails saying
NULL reference to CDO.
Application Flow:
=================
1. The application generates result files in Excel or
text format.
2. If output option is "compress", then the file(s) are
zipped up and the result file(s) are deleted.
3. If the mailing option is "non-secure", then it uses
standard .NET mailing and sends the file(s) as attachment.
4. If the mailing option is "secure" and we have a
digital id of the recipient available, then:
a. A CDO Message is created and the file(s) are attached
to it.
b. The message is encrypted (using CAPICOM) S/MIME
(PKCS#7) format and sent out.
5. The file(s) used as attachment(s) are deleted.
Environment:
============
The application is written in C# and compiled under .NET v
1.1 and runs as a Windows Service on a Windows 2003 /
Windows 2000 server.
Uses:
=====
..NET framework assemblies:
=======================
System;
System.Data
System.Data.SqlClient
System.IO
System.Text
System.Collections
System.Web.Mail
System.Threading
Microsoft.Win32
Custom .NET libraries
=====================
Microsoft.ApplicationBlocks.Data.dll (v 2)
ICSharpCode.SharpZipLib (a ICSharpCOde open source
project)
ICSharpCode.SharpZipLib.Zip (a ICSharpCOde open source
project)
NullableTypes (a sourceforge.net open source project)
COM through Interop:
=========================
Excel 11 (2003)
CDO for Windows 2000
CAPICOM 2.0.0.3 (I had to change a few calls in the
typelib to make it work with .NET)
WaitFor.DLL (from Serverobjects.com - waits till you get
exclusive access to a file)
Partha
|