Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Need VBA code to programmatically access the Blocked senders list

Posted on 2006-11-04
10
677 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
ID: 17873448
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
ID: 17873484
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
ID: 17873628
Look here for Outlook:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:tjeffryes
ID: 17874935
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
ID: 17877361
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
 
LVL 1

Author Comment

by:tjeffryes
ID: 17877434
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
ID: 17877772
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
ID: 17878402
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
ID: 17884116
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
ID: 17888010
You're welcome, Tim.  I'm glad I was able to help out.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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