1
votes

I'm working on an Outlook 2010 add-in that needs to prompt users before following a link found in an email. During the process I'd like to offer the user the choice to trust or block the sender of the email, thus I need to access both lists. I realize that Junk/Spam email options are not exposed by Outlook OM. Although I was successful in accomplishing the task using Redemption, unfortunately I'm not allowed to use it by my employer, so I need to find another way. I found this post (Get Safe sender list in Outlook 2007 C# Add in) that points in the direction of either MAPI properties or registry keys. My preference would be MAPI props, but I'm not sure what object that property belongs to. Would it be the property of the default store?

Outlook.Store obj = Application.Session.DefaultStore;
const string PR_SPAM_TRUSTED_SENDERS_W =
        "http://schemas.microsoft.com/mapi/proptag/0x001f0418";

Outlook.PropertyAccessor pa = obj.PropertyAccessor;
string list= pa.GetProperty(PR_SPAM_TRUSTED_SENDERS_W).ToString();

Unfortunately I'm getting an error message (translated to English) like 'Object doesn't have such property'. In production it would have to work with Outlook clients connected to Exchange 2007 mailboxes.

2

2 Answers

1
votes

Ok found it. The actual property is called PidTagExtendedRuleMessageCondition and the Blob format is described here MS-OXCSPAM and in MS-OXORULE respectively.

0
votes

The property is not set on the store itself, it is set on a hidden message in the Inbox folder (accessible using MAPIFolder.GetStorage) with the message class of IPM.ExtendedRule.Message and PR_RuleMsgProvider = "JunkEmailRule". You should be able to see the hidden message in OutlookSpy (click IMAPIFolder, go to the "Associated Contents" tab). The data is stored is in the PR_EXTENDED_RULE_ACTIONS property.