wieseljonas / java-libpst

Automatically exported from code.google.com/p/java-libpst
1 stars 1 forks source link

Sorting based on Received time #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. moveChildCursor(pos)
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
latest version as in the "downloads" link 0.5 on Windows XP

Please provide any additional information below.

Would like to read the mails(based on the sorted Received time). Basically, the 
assumption here is the cursor initial read position is the Oldest mail. Based 
on that , using moveChildCursor() is reading mails at random positions.

Please help to get read the mails on Sorted(Received column) order.

Thanks

V Sureshkumar

Original issue reported on code.google.com by v.suresh...@gmail.com on 20 Jan 2011 at 10:09

GoogleCodeExporter commented 9 years ago
Hi,

Is the ordering different between using getChildren(numberOfRecords) and 
moveChildCursor?

It should be that:
getChildren(4).get(3) is the same msg as
moveChildCursor(3); getNextChild();

Unfortunately it appears that the PST file format does not have any obvious 
indexes that guarantee message order, otherwise I would have included a bunch 
of orderby functions.  Incidently, this is probably why it takes so damn long 
in Outlook to sort by name, etc in large folders...  The way the library reads 
them is just the order they are stored in the file.

If however we are jumping over emails or something with the moveChildCursor or 
getChildren functions than we have an issue.

Thanks,

Richard

Original comment by rjohnson...@gmail.com on 20 Jan 2011 at 10:45

GoogleCodeExporter commented 9 years ago
Hi Richard

Thanks for the prompt response.

The problem is there start position of the cursor is different at different 
configurations. I am testing in three different machines with different pst(s) 
and the result set(the start position is different) in each machine. Tried to 
change the sorting order in outlook and closed outlook and tested but in vain. 
No matter how the pst file is stored, the results are not consisten using 
moveChildCursor().

Scenario : The pst gets updated with around 500 mails everyday. We need to take 
mails which has arrived in the past fifteen minutes and polled for periodically 
on a set interval. I am using moveChildCursor(). The results are erratic. For 
eg. moveChildCursor(5)  returns with different msgs (i) cursor moved 5 msgs 
from the Oldest (ii) cursor moved 5 msgs from the Newest msg and (iii) 
sometimes randomly in-between.

Please help.

Original comment by v.suresh...@gmail.com on 20 Jan 2011 at 12:27

GoogleCodeExporter commented 9 years ago
Urgh, sounds ugly.  I empathise.

A couple of points here:
- The ordering in outlook does not (to the best of my knowledge) change the 
ordering of messages in the file.
- Opening a PST file while outlook is using it results in bad / unexpected 
things happening.  Operations are not immediately flushed to the file! (hence 
if you shut down outlook incorrectly, it will have to repair the pst)
- The only certain way to get all recently added messages is to get a listing 
of all children before, than a listing of all the children after and compare 
the two.  I'd like to think they are ordered by date added, however I can't be 
sure.

Are you saying that moveChildCursor(5) will retrieve 1 message and then another 
call to moveChildCursor(5) will retrieve a different message on the same PST?

Original comment by rjohnson...@gmail.com on 20 Jan 2011 at 1:01

GoogleCodeExporter commented 9 years ago
Richard

I use as following for getting only 50 mails:    
cursor_pos = pstFolder.getContentCount() - 50
pstFolder.moveChildCursorTo(cursor_pos);

Pls refer to the section "Scenario" in the previous reply for the retrieved 
results. That is the number of msgs read are same. I mean the same set of msgs 
get retrived if you re-run the test. But the problem is while using 
moveChildCursorTo() moves the cursor in different start position in different 
pst files. i.e. sometimes the cursor start position is moved from the Oldest 
msg ; sometimes cursor start position is moved from the Newest msg and 
sometimes in-between somewhere. 
I had tested in the following scenarios : (i) pst file in my local machine (ii) 
pst file in a network shared drive and (iii) another new local machine. In each 
of these scenarios, the cursor start position is different.

Please help.

Thanks

V Sureshkumar

Original comment by v.suresh...@gmail.com on 21 Jan 2011 at 7:42

GoogleCodeExporter commented 9 years ago
Unforuntately I'm really if there is a problem here.  The contents of a folder 
will be ordered however outlook wants to, and I am unaware of any obvious 
mechanism to order the children quickly.

In SVN there is a new function for quickly retrieving a list of child nodes 
(getChildDescriptorNodes).  I recommend you use this to get a listing of 
emails, and then compare against the previous list to identify new emails.

I'm closing this issue for now, but if you can demonstrate that the cursor 
behaves erratically on the same unchanged PST, or misses items, please let me 
know.

Original comment by rjohnson...@gmail.com on 22 Feb 2011 at 11:44

GoogleCodeExporter commented 9 years ago

Original comment by rjohnson...@gmail.com on 22 Feb 2011 at 11:44