We help IT Professionals succeed at work.

redemption.dll and security alert messages

deshaw
deshaw asked
on
Medium Priority
560 Views
Last Modified: 2012-05-06
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
Comment
Watch Question

I use redemption daily and it looks fine to me.

I presume it prints the subject - showing that it has found the item (ie it is not null)
I also presume you have put some data in the body of the message (ie the main message window of the email)
What message are you sending? I am looking at your redAppt and wondering if it is not an ordinary message but a meeting request for example. Not sure how this might work with safeMailItem.

You could try .HTMLBody and .rtfBody instead of .Body, but I would expect them all to have data in - not only one of them.

I would be debugging by setting a breakpoint on the first msgbox and adding a watch to redAppt. Check out which fields are available and what their values are. IOf Body isn't there, or is empty there I it might give some cluse as to where tha data is that you were expecting

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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

Author

Commented:
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.

Author

Commented:
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

Author

Commented:
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

Author

Commented:
Thanks for you time David.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.