Sort by ENTYRID?

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

I've been reading, in various newsgroups, that Sort (and Restrict
also) don't work if you try and sort/restrict by ENTRYID. Does this
only apply to OLE methods, or also Extended MAPI equivalents? I'm
using SortTable() to request a sort by PR_ENTRY_ID, and I'm not
getting any error values, am I just getting lucky?

If it does work, and I'm okay sorting this way, my other question is
-- Is there anyway to access the Outlook/MAPI compare function?
CompareEntryIDs() only returns TRUE/FALSE. Or is the sort method
public knowledege, and therefor not going to change on me? The reason
I'm trying to figure it out is so that I can sort my own copy of an
ENTRYID list in the same manor Outlook sorts them, and then walk down
both lists knowing they are sorted in the same order...

If this doesn't sound like the correct approach, or no one knows the
answer to this. Can anyone tell me if it is safe to sort the array
returned by QueryRows, or would that have an adverse affect on
FreeProws()? If it is safe, I could always sort the Query results
myself, so I know the compare functions wouln't change.
 
I would not rely on any comparisons made by MAPI on any string, be it binary
nor ascii with a length above 64 bytes, on some configurations it appears to
work, on other it wont.

/anton
 
You should be fine doing that, but how rows are sorted by a binary property
is up to the store provider, there aren't any strictly defined rules.
Why exactly do you need to sort the messages by entry id? Are you trying to
match a rowset returned by IMAPITable::QueryRows() with your own list?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
As part of a synchronization scheme I keep a list of Outlook/MAPI
EntryIDs and last modification times on each sync, as well as the id
numbers and modification times of the record they link to in the other
database. I then use QueryRows() at the start of each sync to query
just on entryids and modification times, so I can compare this with
the results saved from the previous synchronization and thus detect
adds/changes/deletes. Your pretty basic sync logic used by many apps
I assume.

Instead of doing lots of loops through rows, even though in memory, it
is faster if I sort them both by entryid and work down both sets of
rows just once.

I went ahead and added code to use qsort() on the rows returned by
QueryRows, and no access violations when I called MAPIFreeBuffer(), so
looks good.

Side Note -
With so many applications synchronizing data with Outlook I would
think Outlook would have made some API to let developers "register" a
link with Outlook, and then a method to have Outlook report changes
made each time a registered app wants to sync. Other APIs I've worked
with have this, like the Palm OS and Timeslips (a time and billing
program), as well as most other popular/major contact management apps.
I know MAPI/OLE can notify you at the time changes are made, but that
all falls apart if you don't happen to be "listening" at the time the
change is made.
 
Exchange provider has an API for that - Incremental change Synchronization
(ICS). PST provider has no such API.
See IExchangeExportChanges, IExchangeImportContentsChanges and
IExchangeImportHierarchyChanges interfaces on MSDN.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Makes since, Microsoft has every right to want to sale Exchange
Server. In my case this application provides some of the
functionality of Exchange Server, for users who don't want/need
everything Exchange Server can do, so I guess I can't expect MS to
make my job easy =) I'm just glad they don't make it impossible,
thanks!
 
Back
Top