Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


March 25, 2002

Finding Redemption


RSS
Subscribe to Windows IT Pro | See More Visual Basic (VB) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

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.

   Previous  [1]  2  Next 


Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...


Exchange Server and Outlook Whitepapers Email Controls and Regulatory Compliance

Take Control of Your Email: Understand the Business Reasons for Email Storage Management

Related Events Deep Dive into Windows Server 2008 R2 presented by John Savill

Bail Out Your Exchange Environment

Check out our list of Free Email Newsletters!

Exchange Server and Outlook eBooks Spam Fighting and Email Security for the 21st Century

Understanding and Leveraging Code Signing Technologies

The Expert's Guide for Exchange 2003: Preparing for, Moving to, and Supporting Exchange Server 2003

Related Exchange Server and Outlook Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format

Exchange & Outlook UPDATE eNewsletter
News, strategies, products, and developments in Exchange Server and Outlook messaging.

Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement