redemption.dll and security alert messages

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
 
D

Dmitry Streblechenko

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
-
 
M

masani paresh

Dmitry,

You are awesome. Thanks a lot. My god it was so simple.

Thanks,
Paresh
 
M

masani paresh

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
 
D

Dmitry Streblechenko

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
-
 
M

masani paresh

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
 
D

Dmitry Streblechenko

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
-
 
M

masani paresh

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
 
D

Dmitry Streblechenko

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
-
 
M

masani paresh

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
 
D

Dmitry Streblechenko

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
-
 
D

Dmitry Streblechenko

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
-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top