ActiveX Mail Recipients

Add-in Express™ Support Service
That's what is more important than anything else

ActiveX Mail Recipients
 
Ken Acker




Posts: 3
Joined: 2005-09-07
Hello.

I am creating an Outlook add-in using VB6 that needs to run in Outlook 2000 and above. I am using the ActiveX version of the Outlook Security Manager but am running into a problem accessing the mail item's recipients.

My code is as follows:

------------------------------------------------------------------------
Private Sub oApp_ItemSend(ByVal Item As Object, Cancel As Boolean)
On Error GoTo ItemAdd_Continue
Dim myMail As MailItem
Dim myRecipient As Recipient

If (TypeOf Item Is MailItem) Then
oOutlookSecurity.DisableOOMWarnings = True
Set myMail = Item

For Each myRecipient In myMail.Recipients
'check mail recipient
Next

myMail.Save
End If

ItemAdd_Continue:
oOutlookSecurity.DisableOOMWarnings = False
End Sub
----------------------------------------------------------------------

Before I used your product, I was getting the security warning on the line "Set myMail = Item". That has been fixed, but now the security warning pops up on the line "For Each myRecipient In myMail.Recipients". The warning states that "A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this?".

What do I need to set to turn off this warning???

Thanks.
Posted 07 Sep, 2005 09:18:07 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Ken,

1. What Outlook version do you use?
2. Did you try your code under VB6 IDE or register your add-in and start Outlook?
3. Could you please compile and test our demo project (see the QDemo\COMAddIn folder). Do you see the security warning?

BTW, I think you'd better place DisableOOMWarnings = False into the IF ENDIF statement because if the item being sent is not mail then you enable warnings without disabling.

If (TypeOf Item Is MailItem) Then
oOutlookSecurity.DisableOOMWarnings = True
Set myMail = Item

For Each myRecipient In myMail.Recipients
'check mail recipient
Next

myMail.Save
oOutlookSecurity.DisableOOMWarnings = False
End If
Posted 07 Sep, 2005 09:49:45 Top
Ken Acker




Posts: 3
Joined: 2005-09-07
Thanks for your reply. I figured out what I was missing. When I created the security manager object I wasn't connecting it to the Outlook application:

Call oOutlookSecurity.ConnectTo(oApp)

Once I added this line, I no longer get the security warning.
Posted 07 Sep, 2005 09:55:53 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Ken,

For Outlook COM Add-ins this method is not needed. Do you run your add-in from VB6 IDE?

Posted 07 Sep, 2005 10:11:30 Top
Ken Acker




Posts: 3
Joined: 2005-09-07
For testing I am. The final product won't be using the IDE.
Posted 07 Sep, 2005 12:36:54 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Ken,

In the final product you will have to remove the ConnectTo method.

Posted 08 Sep, 2005 07:14:34 Top