Problem with Microsoft Interop Outlook
Hello all,
I am trying to collect the body of a mail item under composition using mail.Body collection API, and on every key press this API is getting triggered. If this mail item has a scroll bar due to huge content on every body collection call the scroll bar jumps up and down. To give the gist of what is happening please see the code below which is in C#.
var outApp = Marshal.GetActiveObject("Outlook.Application") as Outlook.Application;
var session = new Redemption.RDOSession();
session.MAPIOBJECT = outApp.Session.MAPIOBJECT;
while (true)
{
var item = outApp.ActiveInspector().CurrentItem as Outlook.MailItem;
Console.WriteLine(item.Body);
}
In actual code the API is triggered only once per key press but in continuous typing this can be considered to be running in an infinite loop.
Please find the attached image GIF of the UI glitch while the program is running.
I would really appreciate suggestions or workarounds if any, thanks a lot.