Outlook Redemption Recipients property causes crash

Y

yads12

I don't know which group to post this to, but I have noticed Dimitry
post replies to this group so maybe he can help me out. I have written
a C# app using Outlook Redemption to send an email. Here is the code in
question



Outlook.Application olApp = new Outlook.ApplicationClass();

Outlook.NameSpace olNS = olApp.GetNamespace("MAPI");

olNS.Logon(Missing.Value, Missing.Value, false, false);

SafeMailItem sItem = new Redemption.SafeMailItem();

Outlook.MailItem olItem =
olApp.CreateItem(Outlook.OlItemType.olMailItem) as
Outlook.MailItem;

sItem.Item = olItem;

sItem.Recipients.Add("(e-mail address removed)");


Running on a Windows XP machine with Outlook 2003 the code works fine.
However when I run it on a Windows 2003 Server with Outlook 2003 the
code crashes when the Recipients property is accessed. Redemption
throws the following exception:
System.Runtime.InteropServices.COMException (0x8000FFFF): Could
retrieve IMessage: Interface not supported
at Redemption.SafeMailItemClass.get_Recipients()

If I just use regular Outlook automation the code works fine, but using
Redemption causes the exception. The Redemption dll has been registered
properly.
 
Y

yads12

I have also written a vbscript using the example on the Outlook
Redemption website:


dim SafeItem, oItem
dim Applicaton, Namespace

set Application = CreateObject("Outlook.Application")
set Namespace = Application.GetNamespace("MAPI")
Namespace.Logon

set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an
instance of Redemption.SafeMailItem
set oItem = Application.CreateItem(0) 'Create a new message
SafeItem.Item = oItem 'set Item property
SafeItem.Recipients.Add "(e-mail address removed)"
SafeItem.Recipients.ResolveAll
SafeItem.Subject = "Testing Redemption"
SafeItem.Send

Running it on that server machine fails at the
SafeItem.Recipients.Add "(e-mail address removed)"
line with the same error.
 
D

Dmitry Streblechenko

Did you install both Outlook and Exchange Server on the same box by any
chance? This is not supported by MS, and what happens with Redemption is
that Outlook and Redemption end up loading different versions of the MAPI
libraries (one Outlook, one Exchange). One of the problems is that memory
allocated by one version of MAPI cannot be freed using a different version.

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

yads12

Yes Dmitry, that's exactly what the problem is. We have Outlook and
Exchange installed on our test server. Thanks.
 

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