Redemption usage with C++builder

  • Thread starter Thread starter John Norman
  • Start date Start date
J

John Norman

I'm trying to get around the Outlook security warning by using
Redemption but I'm stuck with the initialization and usage of the
Redemption object with BCB5.

Code:
---
OutlookApplication1->Connect();
NameSpacePtr pNameSpace =
OutlookApplication1->GetNamespace(WideString("MAPI"));
MailItemPtr pNewMail = OutlookApplication1->CreateItem(olMailItem);

Variant repMail = CreateOleObject("Redemption.SafeMailItem");
repMail.Item = pNewMail; >>>> Fails with "Item no member of Variant"

repMail->Subject = WideString("Automation test");
repMail->To = WideString("(e-mail address removed)");
repMail->Recipients->ResolveAll();
repMail->Send();

// Working fine with Outlook object
//pNewMail->Subject = WideString("Automation test");
//pNewMail->To = WideString("(e-mail address removed)");
//pNewMail->Recipients->ResolveAll();
//pNewMail->Send();

OutlookApplication1->Disconnect();
---

How do I access the Redemption Item object? I noticed Variant is
working with Deplhi, but I'm not sure how this works with BCB.

Thanks,
John N.

- Using Borland CBuilder 5/Outlook XP/Exchange 2000 server -
 
Did you try to import Redemption type library (SafeOutlook) instead of using
late binding?

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

I tried type lib and it works fine. I'm still not able to get the late
binding to work, but as long as the type lib works fine I'm one happy
man!

Here is what I did to get Redemption working with BCB 5:

1. Import SafeOutlok lib: Project > Import Type Library > SafeOutlook
Library > Install

2. Drop TOutlookApplication and TSafeMailItem on your form.

3. Add some code and run application:

OutlookApplication1->Connect();
NameSpacePtr pNameSpace =
OutlookApplication1->GetNamespace(WideString("MAPI"));
MailItemPtr pNewMail = OutlookApplication1->CreateItem(olMailItem);
pNewMail->Subject = WideString("Automation test");
pNewMail->To = WideString("(e-mail address removed)");
// Set Redemption object from type lib to Outlook item
SafeMailItem1->Item = pNewMail;
SafeMailItem1->Recipients->ResolveAll();
SafeMailItem1->Send();
OutlookApplication1->Disconnect();

Have phun,
John N.

- Using Borland CBuilder 5/Outlook XP/Exchange 2000 server -
 
Back
Top