Security Warnings disable, but won't enable.

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

Security Warnings disable, but won't enable.
 
Sean Roulet




Posts: 2
Joined: 2006-06-05
I have installed Outlook Security Manager successfully, and it disbles security warnings.

However, "enabling" them after the VBA code, doesn't actually enable them. It remains switched off.

Is there something wrong?


OlSecurityManager.DisableOOMWarnings = True
OlSecurityManager.DisableCDOWarnings = True
OlSecurityManager.DisableSMAPIWarnings = True
....
My code
...
OlSecurityManager.DisableOOMWarnings = False
OlSecurityManager.DisableCDOWarnings = False
OlSecurityManager.DisableSMAPIWarnings = False



I noticed this was the case when i was trying to work out specifically which warning was being triggered by my code.

Thanks,
Posted 05 Jun, 2006 23:19:01 Top
Dmitry Kostochko


Add-in Express team


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

1. I think you don't need to use the DisableCDOWarnings property at all.
2. Which host are you running the code at (Excel, Word, Outlook, etc.)?
3. Could you please show me your code?

Posted 06 Jun, 2006 05:37:17 Top
Sean Roulet




Posts: 2
Joined: 2006-06-05
Hi Dmitry,
Here are the answers to your above questions.
1.We need to use DisableCDOWarnings property as we are using CDO object to get the from address of an email.
2.We are running the code ot Outlook.
3.Here is my code for getting FromAddress from an email. We are disableing the warnings just before this function is called and then enableing it back after the function gets executed.:-

Public Function GetFromAddress(objMsg)
' start CDO session
Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", False, False
' pass message to CDO
strEntryID = objMsg.EntryID
strStoreID = objMsg.Parent.StoreID
Set objCDOMsg = objSession.GetMessage(strEntryID, strStoreID)

' get sender address
On Error Resume Next
strAddress = objCDOMsg.Sender.Address
If Err = &H80070005 Then
'handle possible security patch error
MsgBox "The Outlook E-mail and CDO Security Patches are " & "apparently installed on this machine. " & "You must response Yes to the prompt about " & "accessing e-mail addresses if you want to " & "get the From address.", vbExclamation, "GetFromAddress"
End If
GetFromAddress = strAddress
Set objCDOMsg = Nothing
objSession.Logoff
Set objSession = Nothing
End Function
Posted 06 Jun, 2006 06:12:02 Top
Dmitry Kostochko


Add-in Express team


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

Thank you for the information. Please try the following code:


Public Function GetFromAddress(objMsg) 
  ' start CDO session 
  Set objSession = CreateObject("MAPI.Session") 
  objSession.Logon "", "", False, False 

  ' CDO is already initialized, so we can disable it
  [B]OlSecurityManager.DisableCDOWarnings = True[/B] 

  ' pass message to CDO 
  strEntryID = objMsg.EntryID 
  strStoreID = objMsg.Parent.StoreID 
  Set objCDOMsg = objSession.GetMessage(strEntryID, strStoreID) 

  ' get sender address 
  On Error Resume Next 
  strAddress = objCDOMsg.Sender.Address 
  If Err = &H80070005 Then 
    'handle possible security patch error 
    MsgBox "The Outlook E-mail and CDO Security Patches are " & "apparently installed on this machine. " & "You must response Yes to the prompt about " & "accessing e-mail addresses if you want to " & "get the From address.", vbExclamation, "GetFromAddress" 
  End If 
  GetFromAddress = strAddress 

  [B]OlSecurityManager.DisableCDOWarnings = False[/B] 

  Set objCDOMsg = Nothing 
  objSession.Logoff 
  Set objSession = Nothing 
End Function 


Posted 06 Jun, 2006 07:00:52 Top