Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

March 25, 2002 12:00 AM

Finding Redemption

Windows IT Pro
InstantDoc ID #24411
Rating: (3)
Downloads
24411.zip

This programming library lets you use Outlook macros without security warnings

If you recently upgraded to Outlook 2002, you might have found that some of the Outlook VBA macros I've presented in my Outlook VBA on Demand columns now trigger a security prompt when the code tries to access mail recipients or send a message. These prompts are among the main effects of the security measures Microsoft added in Outlook 2002 and the earlier Outlook Email Security Update to make it harder to use Outlook to propagate viruses.

You can disable the prompts in a couple of ways. If you connect to Exchange Server, the administrator can implement central security settings that allow programmatic access to certain features, thereby preventing the prompts. If your Exchange environment doesn't include the security settings or if you're a standalone Outlook user, one way to dodge the security prompts is to abandon VBA and Visual Basic (VB) and rewrite your code in C++ or Delphi to use the Extended Messaging API (MAPI) library. That solution isn't practical, though, for most power users or administrators who aren't full-time programmers.

Luckily, an answer also exists for VBA and VB. Outlook Redemption (http://www.dimastr.com/redemption) is a programming library developed by an Outlook Most Valuable Professional (MVP—Microsoft's award for volunteers who help other people get more from Microsoft products). Because Redemption is similar to the Outlook object model, converting most Outlook code to Redemption code is relatively easy. To demonstrate how it works, I've rewritten the code in "Showing the Sender's Email Address," June 2000, InstantDoc ID 8630—which shows the sender's email address, not just the display name, in a mail-folder view—to use Redemption. You can compare the two versions to readily see the changes needed to use Redemption.

Seeking Redemption
To use the Redemption library in Outlook VBA, you first need to download it from the address above and install it. A free version is available for you to try. Then, open the VBA environment and use Tools, References to add a reference to SafeOutlook Library to your project.

Listing 1 shows the code that goes in the built-in ThisOutlookSession module to automatically fill a FromAddress property with the sender's address. The only procedure from my earlier article that I updated is olInboxItems_ItemAdd. To see the FromAddress property whose value the code sets, you need to add that property to the view. The Field Chooser will list it under User-defined properties in folder. If you don't see it there, create a new FromAddress text property.

Redemption includes a "safe" analog for each Outlook item type, with virtually identical properties. To use Redemption's version of an Outlook item, create the appropriate object—SafeMailItem here because we're working with messages—then set its Item property to the actual Outlook item object, as callout A in Listing 1 shows.

A Redemption object supports almost exactly the same properties and methods as the corresponding Outlook object. (The Redemption Web site lists exceptions.) For Outlook properties and methods that trigger security prompts, Redemption provides its own versions that avoid the prompts. Otherwise, it forwards calls to properties and methods to the Outlook object that you assign to the Redemption object's Item property. This behavior lets you easily rewrite Outlook code to use Redemption objects. In many cases, all you need to do is change the parent object so that you're using the safe Redemption object. For example, the statement at callout B in Listing 1 adds a property to hold the sender address by using the same UserProperties.Add method as it would for an Outlook MailItem object.

Related Content:

ARTICLE TOOLS

Comments
  • Anonymous User
    7 years ago
    Aug 10, 2005

    I'd like to see the sender e-mail address (rather than just name). I am a VBA beginning. I tried pasting Listing1 into ThisOutlookSession but nothing has happened. What exactly must one do to 'install' this script? I'd like to see the sender e-mail address for (i) incoming mail and also (ii) sent mail, and would like to be able to (iii) sort by sender e-mail address (which you often cannot do for derived fields).
    THANKS FOR ANY ASSISTANCE!!

  • Anonymous User
    7 years ago
    Feb 25, 2005

    Did not work for me. I still got the warning when trying to access the recipients:

    Set myinspector = CreateObject("Redemption.SafeInspector")
    myinspector.Item = Outlook.Application.ActiveInspector
    Set Recipients = myinspector.CurrentItem.Recipients

  • mal4mac
    8 years ago
    Sep 17, 2004

    For an alternative to redemption, check out:

    http://www.321books.co.uk/ebooks/outlook-vba-tutorial.htm

  • Tom Groszko
    9 years ago
    Dec 08, 2003

    I am gettin nowhere using Redemption with an existing C++ application. Can't find any current docs on what extended MAPI I need to get around the pop-up. Does anybody have C++ code for Redemption or Extended MAPI to get around this problem.

    Thanks

  • buechel
    9 years ago
    Nov 10, 2003

    thanks, but it don't work. outlook crashes on send safemail :(

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.