Solved

Need VBA code to programmatically access the Blocked senders list

Posted on 2006-11-04
10
644 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:tjeffryes
  • 5
  • 3
  • 2
10 Comments
 
LVL 11

Expert Comment

by:ch2
Comment Utility
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
 
LVL 1

Author Comment

by:tjeffryes
Comment Utility
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
 
LVL 11

Assisted Solution

by:ch2
ch2 earned 250 total points
Comment Utility
Look here for Outlook:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook
0
 
LVL 1

Author Comment

by:tjeffryes
Comment Utility
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
 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:tjeffryes
Comment Utility
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
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
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
 
LVL 1

Author Comment

by:tjeffryes
Comment Utility
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
 
LVL 1

Author Comment

by:tjeffryes
Comment Utility
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
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
You're welcome, Tim.  I'm glad I was able to help out.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now