Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem With Redemption

44 views
Skip to first unread message

Faraz Khan

unread,
May 9, 2003, 2:45:26 PM5/9/03
to
I am having a severe problem using the Redemption object (ver
3.2.0.221) in OutLook 2002 SP2. My code is very simple and listed
below.

The problem is this: Everything runs fine as far as Redemption code
is concerned, but then after a few minutes of inactivity in outlook,
when ever I try to send a new email, I get this error: "Operation
cannot be completed due to network or other communication problem.
Check your connection and try again". The email then just sits in the
outbox. Incoming email arrive just fine, only the outgoing cant be
sent. Also the outlook.exe process doesn't die, even if outlook is
closed. To start a new process I have to first kill the existing one
in task manager.

I have to restart outlook to fix the problem, but then if I run the
code again, after a few minutes of inactivity it happens again. I
have verified that if remove the VBA code below or never run it, then
outlook behaves just fine. So whenever I run it the problem happens a
few minutes after a period of inactivity. Version 2.0.0.536 which I
was using earlier had the same problem.

The code below causes the problem:

Public Sub Test()

Dim Dic As New Dictionary
Dim SMI As New SafeMailItem
Dim MI As MailItem

Set MI = Application.ActiveExplorer.CurrentFolder.Items(1)

SMI.Item = MI

MsgBox SMI.Sender.Address

SMI.Item = Nothing 'Removing this line has no effect
Set SMI = Nothing
Set Dic = Nothing
Set MI = Nothing

End Sub


Thanks,
Faraz Khan

Dmitry Streblechenko

unread,
May 9, 2003, 6:44:58 PM5/9/03
to
Accessing the Sender property causes Redemption to retrieve (and cache for
later use) the Extended MAPI session. Outlook 2002 might not like it. To
work around the problem:
1. Create an instance of Redemption.MAPIUtils object and call Cleanup. It
will release the cached session shared among all Redemption objects.
2. In your particular case, there is no reason to access the Sender
property. You can just as easily use

PR_SENDER_EMAIL_ADDRESS = &H0C1F001E
MsgBox SMI.Fields(PR_SENDER_EMAIL_ADDRESS)

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


"Faraz Khan" <faraz...@asu.edu> wrote in message
news:a882fd73.03050...@posting.google.com...

George Hester

unread,
May 10, 2003, 7:15:16 PM5/10/03
to
I ran into this problem also. But with me the MAPI login died. Don't know how to fix this.

--
George Hester
__________________________________


"Faraz Khan" <faraz...@asu.edu> wrote in message news:a882fd73.03050...@posting.google.com...

Stuart MacDonald

unread,
May 12, 2003, 11:25:26 AM5/12/03
to
"Faraz Khan" <faraz...@asu.edu> wrote

> The code below causes the problem:
>
> Public Sub Test()
>
> Dim Dic As New Dictionary
> Dim SMI As New SafeMailItem
> Dim MI As MailItem

This line allocates a MailItem-size storage space, and initialises
it...

> Set MI = Application.ActiveExplorer.CurrentFolder.Items(1)

...and this line makes it point at something else. Is this legal VBA?
I'm new to VBA programming and might be misunderstanding the set
statement.

...Stu

Faraz Khan

unread,
May 12, 2003, 1:23:45 PM5/12/03
to

I found that the 2nd method (calling SafeMailItem.Fields(X))does not
solve the problem. However the 1st method: calling MAPIUtil.Clean()
fixed it. Thank you Dmitry.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Faraz Khan

unread,
May 12, 2003, 1:33:34 PM5/12/03
to

I think you might be confusing the SMI variable with the MI variable.
MI variable is never intialized, it is only declared.

Even if MI was intializied then when I point MI to something else, VBA
(or VB) is smart enough to know that the real object in memory is no
longer in use, and so it will free up the space for us. But it is bad
practice to do that.

There are 2 keywords for assigning values or objects to variables, SET &
LET. The SET keyword is used for object variables and LET for values,
but LET is optional. For example:

Dim Obj as Object
Dim I as integer

LET I = 13 'LET is optional
I = 13 'same as above

SET Obj = Something

Dmitry Streblechenko

unread,
May 12, 2003, 6:27:45 PM5/12/03
to
This probably means that you do something else with Redemption that causes
it to cache an Extended MAPI session.

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


"Faraz Khan" <faraz...@asu.edu> wrote in message

news:#8Lv#sKGDH...@TK2MSFTNGP12.phx.gbl...

Dmitry Streblechenko

unread,
May 12, 2003, 6:28:29 PM5/12/03
to
What do you mean "But with me the MAPI login died"?

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


"George Hester" <heste...@hotmail.com> wrote in message
news:ezzsFo0F...@tk2msftngp13.phx.gbl...

George Hester

unread,
May 13, 2003, 11:57:34 AM5/13/03
to
No longer could I Send\Receive. The Session died. I would get no SPAM and I knew that wasn't right. So I would hit Send\Receive. Dead Error MAPI session died. Had to rmove the dll.

--
George Hester
__________________________________
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message news:uxohdWNG...@TK2MSFTNGP10.phx.gbl...

Dmitry Streblechenko

unread,
May 13, 2003, 3:08:18 PM5/13/03
to
Yep, that's an indication that Outlook's session had been cached by
Redemption, and that confused Outlook. What is your Redemption code?

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


"George Hester" <heste...@hotmail.com> wrote in message

news:#6WshhWG...@tk2msftngp13.phx.gbl...

George Hester

unread,
May 14, 2003, 1:01:42 AM5/14/03
to
Exactly this:

http://www.slipstick.com/dev/code/autoaddrecip.htm

--
George Hester
__________________________________
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message news:#JnWQLYG...@tk2msftngp13.phx.gbl...

Dmitry Streblechenko

unread,
May 14, 2003, 1:20:02 PM5/14/03
to
Hmmm... Did you try to add the following two lines of code to the end of the
sub?

set Utils = CreateObject("Redemption.MAPIUtils")
Utils.Cleanup

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


"George Hester" <heste...@hotmail.com> wrote in message

news:OHajRedG...@TK2MSFTNGP10.phx.gbl...

George Hester

unread,
May 14, 2003, 6:50:27 PM5/14/03
to
No because it broke the session and I just removed the dll. I can try putting it back and do what you suggest. Hope that works. Thanks Dmitry.

--
George Hester
__________________________________
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message news:#Q80azjG...@tk2msftngp13.phx.gbl...

0 new messages