I need to loop all Outlook items and search for strings that full fill a regular expression pattern including all the attachments.
I know this is a big operation and require a lot of resources, but the project is demand to do this.
I managed to make a VSTO plugin that can do this, but the problem is that the addin cause Outlook to hang sometimes. This is not a good business solution, it is not working stable.
In my code I have make sure that I close COM object after using it.
outlookItem.Close(OlInspectorClose.olDiscard);
Marshal.ReleaseComObject(outlookItem);
The attachments are convert to steam and dispose efter using.
string AttachSchema = "http://schemas.microsoft.com/mapi/proptag/0x37010102";
byte[] filebyte = null;
PropertyAccessor pacc = attachment.PropertyAccessor;
filebyte = (byte[])pacc.GetProperty(AttachSchema);
Stream stream = new MemoryStream(filebyte);
Anyone can give some suggestions on how to make to addin stable?