'PR_SPAM_TRUSTED_SENDERS_W and PR_SPAM_BLOCKED_SENDERS
I've played quite a bit with "PR_SPAM_BLOCKED_SENDERS" ("http://schemas.microsoft.com/mapi/proptag/0x6106001F") and using VBA to manipulate/update my Spam list in real time in OL (o365), and it works just great. I long forgot how and where I got hold of the proptag for it, but I did somehow, and now I need to get hold of the safe list (PR_SPAM_TRUSTED_SENDERS_W) as well, but the only proptag ("http://schemas.microsoft.com/mapi/proptag/0x001f0418") I've found so far fails:-(
Can you help me out here - what is the correct proptag?
Here is some base code that work great for the blocked (PR_SPAM_BLOCKED_SENDERS), but not the safe (PR_SPAM_TRUSTED_SENDERS_W):
Const PR_SPAM_TRUSTED_SENDERS_W = "http://schemas.microsoft.com/mapi/proptag/0x001f0418"
Const PR_SPAM_BLOCKED_SENDERS = "http://schemas.microsoft.com/mapi/proptag/0x6106001F"
Set oStorage = oInbox.GetStorage("Junk E-mail Rule", olIdentifyBySubject)
Set oPropAcc = oStorage.propertyAccessor
sBlockedSenders = oPropAcc.GetProperty(PR_SPAM_BLOCKED_SENDERS)
Debug.Print sBlockedSenders
Many thanks in advance!
Best Regards,
Bjarne Dein
Solution 1:[1]
The data is stored inside the PR_EXTENDED_RULE_CONDITION
binary property - take a look at the rule with OutlookSpy (I am its author) - go to the Inbox folder, click IMAPIFolder button, find the rule hidden message on the "Associated Contents" tab, open the message. Select the PR_EXTENDED_RULE_CONDITION property - OutlookSpy will parse it and display its data. You can also take a look at the IMAPIFolder | PR_RULES_TABLE tab.
You can either parse that property, or use Redemption (I am also its author) - it exposes the RDOJunkEmailOptions object:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set JunkOptions = Session.JunkEmailOptions
for each vAddress in JunkOptions.TrustedSenders
Debug.Print vAddress
next
In case of an Exchange mailbox, here is how the rule looks like:
rt : RES_AND
cRes : 2
lpRes :
rt : RES_OR
cRes : 2
lpRes :
rt : RES_OR
cRes : 1
lpRes :
rt : RES_CONTENT
resContent :
ulFuzzyLevel : FL_FULLSTRING FL_IGNORECASE
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
lpProp :
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
Value : [email protected]
rt : RES_AND
cRes : 2
lpRes :
rt : RES_OR
cRes : 2
lpRes :
rt : RES_AND
cRes : 2
lpRes :
rt : RES_EXIST
res.resExist :
ulPropTag : PR_CONTENT_FILTER_SCL (0x40760003)
rt : RES_PROPERTY
res.resProperty :
relop : RELOP_GT
ulPropTag : PR_CONTENT_FILTER_SCL (0x40760003)
lpProp :
ulPropTag : PR_CONTENT_FILTER_SCL (0x40760003)
Value : -1
rt : RES_OR
cRes : 0
lpRes :
rt : RES_NOT
res.resNot :
lpRes :
rt : RES_OR
cRes : 2
lpRes :
rt : RES_OR
cRes : 1
lpRes :
rt : RES_CONTENT
resContent :
ulFuzzyLevel : FL_SUBSTRING FL_IGNORECASE
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
lpProp :
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
Value : @safe.sender.domain.com
rt : RES_SUBRESTRICTION
resSub :
ulSubObject : PR_MESSAGE_RECIPIENTS
lpRes : rt : RES_OR
cRes : 0
lpRes :
rt : RES_NOT
res.resNot :
lpRes :
rt : RES_OR
cRes : 3
lpRes :
rt : RES_OR
cRes : 5
lpRes :
rt : RES_CONTENT
resContent :
ulFuzzyLevel : FL_FULLSTRING FL_IGNORECASE
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
lpProp :
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
Value : [email protected]
rt : RES_CONTENT
resContent :
ulFuzzyLevel : FL_FULLSTRING FL_IGNORECASE
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
lpProp :
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
Value : [email protected]
rt : RES_CONTENT
resContent :
ulFuzzyLevel : FL_FULLSTRING FL_IGNORECASE
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
lpProp :
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
Value : [email protected]
rt : RES_CONTENT
resContent :
ulFuzzyLevel : FL_FULLSTRING FL_IGNORECASE
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
lpProp :
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
Value : [email protected]
rt : RES_CONTENT
resContent :
ulFuzzyLevel : FL_FULLSTRING FL_IGNORECASE
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
lpProp :
ulPropTag : PR_SENDER_EMAIL_ADDRESS_W (0x0C1F001F)
Value : [email protected]
rt : RES_SUBRESTRICTION
resSub :
ulSubObject : PR_MESSAGE_RECIPIENTS
lpRes : rt : RES_OR
cRes : 0
lpRes :
rt : RES_OR
cRes : 0
lpRes :
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 |