Search code examples
outlook-redemption

getting preferences for ReadReceiptRequested and OriginatorDeliveryReportRequested from MailItem without triggering Outlook Security Patch


I would like to use Redemption library (currently on version 5.27.0.6916) to get preferences for properties ReadReceiptRequested and OriginatorDeliveryReportRequested by creating a new MailItem in Inbox Folder and reading them. Accessing them via Outlook Object Model (OOM) interop triggers the Outlook Security Patch, resulting in a confirmation dialog/security prompt (strangely enough, this only seems to happen in a terminalserver session).

I tried to use SafeMailItem, but those properties are not implemented.

I have a fallback to read from registry, but is there a way to do this with Redemption? And is there an explanation for why this would only happen in a terminalserver session?

`

var mailItem = Folders.NewItem<MailItem>(Stores.Get(accountId), DefaultFolders.Inbox); 

try
{
    return new CMailPreferences
    {
        DeliveryReceiptRequested = mailItem.OriginatorDeliveryReportRequested,
        ReadReceiptRequested = mailItem.ReadReceiptRequested,
    };
}
finally
{
    Marshal.ReleaseComObject(mailItem);
}

`


Solution

  • You can try to create an instance of the RDOSession object (once, not in a loop) and call RDOSession.GetRDOObjectFromOutlookObject(mailItem) to open the item as RDOMail object.