Solved

Need VBA code to programmatically access the Blocked senders list

Posted on 2006-11-04
10
685 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
[X]
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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

733 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