redemption.dll and security alert messages

  • Thread starter Thread starter masani paresh
  • Start date Start date
M

masani paresh

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 "subject: " & redAppt.Subject //prints subject correctly
MsgBox "body: " & redAppt.Body //Always print empty string
End Sub

I also tried with MessageItem but it doesnt print anything. 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 "subject: " & redAppt.Subject
MsgBox "body: " & redAppt.Body
End Sub

Thanks
 
Make sure the Outlook item is saved:

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


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Hey Dmitry,

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,
Paresh
 
Version shouldn't make any difference, but it is hard to say withoput
actually running teh code udner a debugger in your particular case.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
There were so many other things as well not working with old Redemption.dll.
Will it make any difference if we change name of Redemption.dll to say
myredemption.dll?

Could you please tell me how to run the debuger?

Thanks,
Paresh
 
Make any difference in what sense? Keep in midn that renaming teh dll will
change teh names of all the cretable Redemption objects.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Hey Dmitry,
Do you mean if I have renamed Redemption.dll to myredemption.dll then I have
to write everything like below:

Dim redAppt As myredemption.SafeAppointmentItem
Set redAppt = CreateObject("myredemption.SafeAppointmentItem") or
Set redAppt = New myredemption.SafeAppointmentItem

Is it correct? Could you tell me what is the difference in instantiating
object wiht "New" keyword or using "CreateObject"?

Thanks,
Paresh
 
No, the Dim statement is still the same:
Dim redAppt As Redemption.SafeAppointmentItem
That only tells the compiler about the type of the object and the layout of
its v-table.

When you call New, the GUID to be used when callling CoCreateInstance() at
run time will be hardcoded at compile time, and it will have a value that
comes from the type library (which is not modified when customing).
Customization only changes the way the Redemption classes are registered in
the registry, hence you need to use CreatObject(), which will call
CLSIDFromProgID at run time to retrieve the class id from teh (customized)
class ane mand only then call CoCreateInstance.


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Thanks Dmitry, It was much useful.

In first reply you suggested to user "Item.Save" and it worked fine but some
time I am facing problem with that while forwarding mail. It says "Operation
failed" or "Permission denied" message at Item.Save place. Could you tell me
what could be wrong? Moreover, after that error message, Outlook will not
allow me to send that mail and I have to restart the Outlook to make it work.

Thanks,
Paresh
 
Doyou have a reproducible scenario?
Are you processing a large (hundreds) messages at a time?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Sorry, it should read:
Are you processing a large (hundreds) number of messages at a time?
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Back
Top