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. |
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
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
|
|
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. |
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
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?
|
|
Ken Acker
Posts: 3
Joined: 2005-09-07
|
For testing I am. The final product won't be using the IDE. |
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Ken,
In the final product you will have to remove the ConnectTo method.
|
|