Need VBA code to programmatically access the Blocked senders list

I'm writing an app for a friend and I need to be able to programmatically access the Blocked Senders list in Outlook.  I can't find it in the object model and I'm not sure if it's stored in a hidden message, external file, registry or what.

Anybody know?

Tim Jeffryes
LVL 1
tjeffryesAsked:
Who is Participating?
 
David LeeConnect With a Mentor Commented:
Hi tjeffryes,

The blocked senders list is stored under the registry key ch2 gave.  On my system it's at the key listed below.  The blocked senders are stored in unicode format.  I don't know if the entire list is stored here or if the list might be spread across multiple keys if there are more than a certain number of entries.

HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\0a0d020000000000c000000000000046\001f041a


Cheers!
0
 
ch2Commented:
the senders are stored in a registry key:

HKEY_CURRENT_USER\Identities\{xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx\Software\Microsoft\Outlook Express\5.0\Block Senders
0
 
tjeffryesAuthor Commented:
ch2:

Thanks very much.  In Outlook I seem to have well over 50 items in the blocked senders list.  While there is a key in my registry of the path you specified, the only 2 items under that key are:

(Default)
Version

(Default) has no value
Version has a value of 50000

There's nothing else there.  

That's on one machine.  On my laptop, I find HKEY_CURRENT_USER\Identities\{xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx\Software\Microsoft\Outlook Express\5.0\ but no "blocked Senders".


I probably should have been clearer in my posting.  This is definitely Outlook and not Outlook Express.

Also, interestingly, I just this mornign used the Office Setting migration wizard from my old machine to my new and the Blocked Senders list came over just fine.  Would be interesting to know how it was done.

Tim Jeffryes


0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
ch2Connect With a Mentor Commented:
Look here for Outlook:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook
0
 
tjeffryesAuthor Commented:
Hey, CH2:

Thanks again for the posting.  However, I got to that key and I find a ton of keys under \Outlook but nothing I can recognize as Blocked Senders.  Any idea?

Thanks again.

Tim
0
 
tjeffryesAuthor Commented:
Okay, guys.  Looks like you both pointed me in the right direction.  

BlueDevilFan, that key is the exact one I have and if I'm reading it right the first entry seems to match my first Blocked sender and the last entry seems to match my last blocked sender.

Now, a number of other questions:

1.  I have other questions that led from this, but in essence you have answered my original question.  So do I award now and create a new posting for my addtitional questions or can I ask them here?
2.  Since this is asynchronous, I'll ask now anyway and await the replies.
3. I'm not certain how to decode a binary registry entry in VBA.  Does it require a Windows API call if I'm not using .NET?  
4. In all my VBA work, I generally only retrieve string values from the regsitry or simple REG_DWORD values.  I really don't know how to decode the binary values.
5. Why would these registry keys be so cryptic and any idea as to whether I can rely on those keys to be found on other machines?

Tim

0
 
David LeeCommented:
Hi, Tim.

In answer to your questions:

1.  Yes, you really should close this question and open an additional one for each question.  But since you've asked them here already ...
3 & 4.  No, it doesn't require a call to an API.  The following code will decode and display the contents of this registry key

Dim WshShell, arrValues, intIndex, varValue
Set WshShell = WScript.CreateObject("WScript.Shell")
arrValues = WshShell.RegRead("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\0a0d020000000000c000000000000046\001f041a")
Set WshShell = Nothing
For intIndex = LBound(arrValues) To UBound(arrValues) Step 2
      varValue = varValue & Chr(arrValues(intIndex))
Next
arrValues = split(varValue, ";")
For intIndex = LBound(arrValues) To UBound(arrValues)
    Wscript.Echo arrValues(intIndex)
Next

5.  Good question.  Only Microsoft can answer that one.  You can definitely rely on the key down to Outlook existing.  I'm not sure about the portion of the key after Outlook (i.e. the one begining with 0a0d) beign the same.  I've searched and searched but have not been able to find any documentation on the Outlook profile.  
0
 
tjeffryesAuthor Commented:
BlueDevilFan:

You rock!  Thanks so much.

So here's what I'm doing.  I'm giving each of you 1/2 the points.  

Additionally, I've reposted the question regarding binary registry entries so that I can reward BlueDevilFan some more points.  So BlueDevilFan, please go to the link below and re-submit your answer and I'll award you more points.

Thanks to both of you!!!

Tim Jeffryes

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_22049870.html
0
 
tjeffryesAuthor Commented:
Just a follow-up comment:

the \Outlook\ portion of the registry key turns out to be the name of the current profile being used for outlook.  

So..... now i have to find code to find the current profile.

Tim
0
 
David LeeCommented:
You're welcome, Tim.  I'm glad I was able to help out.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.