Microsoft KB Archive/329765

= You receive a security message when you try to access the Address Book programmatically by using the Outlook object model =

Article ID: 329765

Article Last Modified on 7/28/2006

-

APPLIES TO


 * Microsoft Outlook 2002 Standard Edition

-



This article was previously published under Q329765





SYMPTOMS
If you try to gain access to the Address Book programmatically by using the Outlook object model when Outlook is not running, you may receive the following security prompt, even though Allow access to address book via Outlook object model is correctly enabled in the Outlook 10 Security Settings Folder.

A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this?

If this is unexpected, it may be a virus and you should choose &quot;No&quot;.



CAUSE
This behavior occurs because there is no running session of Outlook to determine the correct security profile to load. Therefore, the default security profile is used, causing the security prompt.

When you programmatically access an item in the Address Book, a session must be running to determine the correct security profile to load. When Microsoft Outlook 2002 is not running, the security dialog prompts the user because the default security profile is used.



WORKAROUND
To work around this issue, use the second code example in this section.

For example, this Visual Basic Scripting (VBS) Language code causes the security prompt to appear:    Set ol      = CreateObject(&quot;Outlook.Application&quot;) Set AL     = ol.session.addresslists(&quot;Global Address List&quot;) Set AE     = AL.addressEntries(1) MsgBox AE.address

The following code works around the issue by causing a persistent reference to the established Outlook session, and therefore does not raise the security prompt:    Set ol      = CreateObject(&quot;Outlook.Application&quot;) Set session = ol.session Set AL     = ol.session.addresslists(&quot;Global Address List&quot;) Set AE     = AL.addressEntries(1) MsgBox AE.address



MORE INFORMATION
For additional information about e-mail security features, click the article number below to view the article in the Microsoft Knowledge Base:

290499 OL2002: Administrator Information About E-Mail Security Features

Keywords: kbsecurity kbprogramming kbvba kbfix kbprb KB329765

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.