Link to home
Start Free TrialLog in
Avatar of deshaw
deshawFlag for India

asked on

redemption.dll and security alert messages

Hi,

I understand that redemption.dll library is the way for safe operations in outlook VBA programming.  Sometimes it works strange way it might be possible that I am missing something.  Could any one tell me in below code why it is printing Body as empty string?

Private Sub Application_ItemSend(ByVal Item As Object, _
                                 Cancel As Boolean)      
    Dim redAppt As Redemption.SafeMailItem
    Set redAppt = CreateObject("Redemption.SafeMailItem")
    redAppt.Item = Item            
    MsgBox "subject1: " & redAppt.Subject
    MsgBox "subject1: " & redAppt.Body    //Always print empty string
End Sub

I also tried with MessageItem but no luck. Could you also tell me what is the difference between SafeMailItem and MessageItem?

Private Sub Application_ItemSend(ByVal Item As Object, _
                                 Cancel As Boolean)      
    Dim redAppt As Redemption.MessageItem
    Set redAppt = CreateObject("Redemption.MessageItem")
    redAppt.Item = Item            
    MsgBox "subject1: " & redAppt.Subject
    MsgBox "subject1: " & redAppt.Body    //Always print empty string
End Sub

Thanks
ASKER CERTIFIED SOLUTION
Avatar of DavidT543
DavidT543
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deshaw

ASKER

Thanks for reply. All your presumptions are valid.
>>What message are you sending?
I am sending just normal messages. Please note that Item.Body prints correct body message but it alerts security message. and thats a reason I used redemption library and assigned Item to it.
>>You could try .HTMLBody and .rtfBody instead of .Body,
I have tried everything but for all it prints null for all.
Like you, I also use Redemption.dll extensively but I have problem only in given code while sending item. I think there something to do with  " redAppt.Item = Item " but not sure whats going wrong.
Private Sub Application_ItemSend(ByVal Item As Object, _
                                 Cancel As Boolean)      
    Dim redAppt As Redemption.SafeMailItem
    Set redAppt = CreateObject("Redemption.SafeMailItem")
    redAppt.Item = Item            
    MsgBox "subject1: " & redAppt.Subject
    MsgBox "subject1: " & redAppt.Body    //Always print empty string
End Sub
Thanks.
What about if you debug and use a breakpoint on the msgbox. If you set a watch on redAppt - what fields can you see? What is the contents of body?

Which version of redemption are you using?

Where are you calling it from? Is this an external executable, or a COM add-in or a VBA macro
Avatar of deshaw

ASKER

Hi, Please find the answers to your questions.
>>If you set a watch on redAppt - what fields can you see?
It is really weird. I cannot see Subject in the field but Body is available. Though redAppt.Subject field gives the Subject value correctly.
One more thing I noticed is, Item itself contain only subject line(when i keep mouse o redAppt.Item = Item line it shows me the subject as a contents.)
>>What is the contents of body?
When I keep mouse on redAppt.Subject it don't show anything but redAppt.Body show "" string.
>>Which version of redemption are you using?
It is 4.7.0.1026 and I downloaded developer version from http://www.dimastr.com/redemption/download.htm
I have also tried with older version and got same behaviour for all.
>>Where are you calling it from?
If you noticed, I am using it in Application_ItemSend event and it is VBA ofcourse macro placed under ThisOutlookSession.
Could you please try below simple macro in your outlook session and let me know if it works for you.

Private Sub Application_ItemSend(ByVal Item As Object, _
                                Cancel As Boolean)      
    Dim redAppt As Redemption.SafeMailItem
   Set redAppt = CreateObject("Redemption.SafeMailItem")
   redAppt.Item = Item            
   MsgBox "subject: " & redAppt.Subject
   MsgBox "body:" & redAppt.Body    'Always print empty string
End Sub  
Thanks for being there.
Avatar of deshaw

ASKER

Hi DavidT543,
It works perfect when I have added Item.Save at start of the function. Thanks for being there. Assigning you full points.
Thanks,
Paresh
Avatar of deshaw

ASKER

Hi DavidT543, One question for you :)
I noticed that it is not working with V4.1.0.507 but works with V4.7.0.1026. Could you tell me why it is so?
Thanks,
Hi Paresh,

4.1 was a very old version (3 years old) with lots of features missing, and un-fixed bugs.
4.7 is a new version just released today - I haven't even seen it yet.

But the problem with your code may well have been the version rather than the item.save

I just looked at the Bugs it fixes and it fixes a bug I was having with unicode characters - so you have helped me as well.

Its good to converse with a fellow Redemption user.

Cheers Paresh

David
Avatar of deshaw

ASKER

Thanks for you time David.