MapiTable in OL 2000 slow

  • Thread starter Thread starter Peter Marchert
  • Start date Start date
P

Peter Marchert

Hello,

in OL 2000 sql queries are unnormally slow. The following code
sometimes take more then 1 second to finnish (without logon):

Option Explicit

Dim g_objRDOSession As Object

Public Sub Test()

Dim objFolder As Object
Dim sglStart As Single
Dim sglEnd As Single

If g_objRDOSession Is Nothing Then
Set g_objRDOSession = CreateObject("Redemption.RDOSession")
Call g_objRDOSession.Logon("", "", False, False, 0)
End If

Set objFolder = Outlook.Session.GetDefaultFolder(olFolderCalendar)
sglStart = Timer
Debug.Print ExecuteSQL(objFolder)
sglEnd = Timer
Debug.Print "Duration: " & sglEnd - sglStart & " seconds"

End Sub

Public Function ExecuteSQL(ByVal objFolder As Object) As String

Dim objTable As Object
Dim objRecordSet As Object
Dim strSQL As String

Set objTable = CreateObject("Redemption.MAPITable")

objTable.Item = g_objRDOSession.GetFolderFromID(objFolder.EntryID,
_
objFolder.Parent.StoreID).Items

strSQL = "SELECT Subject FROM Folder WHERE (Subject <> '')"

Set objRecordSet = objTable.ExecSQL(strSQL)

ExecuteSQL = "TEST"

End Function

I tried this code with OL 2000/SP3 on a Win 2000/SP4 machine and an
Exchange Server 2003. I also tried it without Exchange and a local pst
file. Seems to be a little bit faster but not significant. On 2002 and
higher it works fine (tried on XP and Vista machines).

So the question is: Is this a known issu from OL/WIN 2000 or may be
the redemption can cause the problem?

Thanks for any hints.

Peter
 
Redemption version is 4.5.0.780 but I think to remember I tested it
with 730 too.
 
How many items does that folder contain? Is Outlook 2000 using online mode
vs cached in the odler versions of Outlook.
1 second sounds very much reasonable to me...

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Thanks for your reply, Dmitry.
How many items does that folder contain?
The folder is empty (I`m only testing).

Is Outlook 2000 using online mode?

I´m not sure. Right now I`m testing without an Exchange Server.

Here some results:
1 seconds
0,64 seconds
0,61 seconds
0,54 seconds
0,57 seconds
0,77 seconds

Peter
 
Some more information: If I run the code in a loop:

For lngLoop = 1 To 25
Set objFolder =
Outlook.Session.GetDefaultFolder(olFolderCalendar)
sglStart = Timer
Call ExecuteSQL(objFolder)
sglEnd = Timer
Debug.Print "Duration: " & sglEnd - sglStart & " seconds"
Next lngLoop

It takes for every loop nearly exactly 1 second to finnish.

Peter
 
What id you take the GetDefaultFolder call from the loop?
Is Outlook 2000 installed in the C/W or IMO mode (see Help | About)?

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

Some more information: If I run the code in a loop:

For lngLoop = 1 To 25
Set objFolder =
Outlook.Session.GetDefaultFolder(olFolderCalendar)
sglStart = Timer
Call ExecuteSQL(objFolder)
sglEnd = Timer
Debug.Print "Duration: " & sglEnd - sglStart & " seconds"
Next lngLoop

It takes for every loop nearly exactly 1 second to finnish.

Peter
 
OL is installed in the IMO.

Ups! It was in CW-Mode with an pop account. Now I changed to IMO and
it works.

But on the other vpc (Exhange C/W) the problem still exists.

Peter
 
I mean "if":
What if you take the GetDefaultFolder call from the loop?

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

Hmm, sorry I don`t know which id you mean.

OL is installed in the IMO.

Peter
 
Thank you, Dmitry.

It seems that it`s not the SQL-Statement but the GetFolderFromID
method. With the OOM method
"Outlook.ActiveExplorer.CurrentFolder.Items" it works normal.

Peter
 
Back
Top