'C# Add-In (VSTO .NET): Add domain name to outlook junk-email list

With the Outlook UI you can add an email address to your junk-email list, you can add a domain name as trusted domain, but you can't add a domain name to your junk-email list. You must manually edit the email address in your junk-email list to achieve that, so I wrote an Add-In to do this for me, but cant find the method to do that. Apparently the Outlook object model doesn't provide anything for that.

Is there a code workaround for this fatal limitation?



Solution 1:[1]

That is correct. Outlook Object Model does not provide any means to access or manipulate Junk Email settings.

You can try to use Extended MAPI (C++ or Delphi) to build the MAPI server side rule that lists all the blocked senders, but it is definitely not for the faint-hearted.

If using Redemption (I am its author) is an option, it exposes RDOJunkEmailOptions object (returned from RDOSession.JunkEmailOptions, RDOAccount.JunkEmailOptions, RDOExchangeMailboxStore.JunkEmailOptions), which allow to add blocked senders using RDOJunkEmailOptions.BlockedSenders.Add.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1