Re: Retrieving selected items from folder contents table
- From: "Dave Smith" <Dave@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 23 Jan 2006 14:06:41 -0500
These are good questions, Dmitry. Before Exchange Server 2003, this is
exactly what I did - Get the EntryID from GetSelectionItem and then call
OpenEntry to find out about the message. However, two changes made this less
than desireable.
1. Available since Exchange 2000 but now the default in Exchange 2003, there
is a limit of 250 simultaneous open messages on the server by any one
client. I want to cache information about the currently selected messages
without having to open and then close each message individually. Therefore,
I get the CurrentFolder from the ActiveExplorer and open its contents table.
Addressees, subject, and all of the other information I want to remember is
in there without actually opening the message itself.
2. If the user has configured their Outlook to download headers only,
calling OpenEntry downloads the body of the message. Since I want this
information in response to an OnSelectionChange event, if I use OpenEntry it
defeats the value of headers only, since my OnSelectionChange code will
download the rest of the message as soon as it is selected.
So, I discovered through Outlook Spy that all of the information I need is
in the folder's contents table even if the user is downloading headers only.
The open message limit brings up another question. After calling OpenEntry
to get an IMessage interface pointer on the server-based message, how do I
"close" that message. I thought I would simply need to release (i.e.
IUnknown::Release()) the interface; however, a test I just finished seems to
indicate that I am still hitting the 250 message limit. (I dragged 600
messages from an Outlook folder to a folder in my message store and all of
the copies failed after 250 message has been copied.) Maybe I have a bug in
my logic to release the IMessage interface, and I will check that. Am I
correct in that this is all that is required to close the message?
Dave Smith
"Dmitry Streblechenko" <dmitry@xxxxxxxxxxx> wrote in message
news:O417DpEIGHA.740@xxxxxxxxxxxxxxxxxxxxxxx
> Message selection is a UI function. MAPI itself knows absolutely nothing
> about which mesasge is selected in Outlook. Plus you can have more than
> one explorer displaying the folder, all with different selection.
> Why do you even need to do anything with IMAPITable? If you know the entry
> ids of the selected messages from the Explorer.Selection collection, why
> not simply access these messages? What does IMAPITable give you that
> IMessage can't?
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Dave Smith" <Dave@xxxxxxxxxxxxxxxxxxxx> wrote in message
> news:uxb5dgEIGHA.1032@xxxxxxxxxxxxxxxxxxxxxxx
>> First, is there a way to set up a restriction to IMAPITable::QueryRows
>> such that it returns any row for which that item in the current
>> explorer's table view is selected?
>>
>> I have not found it; therefore, I am doing the following (using some
>> psuedocode posted some months ago by Dmitry, with my thanks).
>>
>> Open current folder from the active explorer and get its contents table
>> Use SeekRow to position to the first record - just in case
>> Cycle through the items returned from successive calls to
>> GetSelectionItem
>> For each selected item
>> Create a restriction on the EntryID
>> Call FindRow(&EIDRestrict, BOOKMARK_CURRENT ...)
>> Call QueryRows(1, 0, ...)
>> Process that record
>> Next
>> FreeProws ands get the next item from the selection
>>
>> Notice that I do not sort the contents table. If the current view is
>> sorted in descending order by receive date, this works fantastically, and
>> it really screams - performance-wise
>>
>> However, if the current view is sorted by some other column, I need to
>> sort the contents table on that same column.
>>
>> So, how can I determine the current sorting of the explorer view so that
>> I can apply that same sort to contents table and get things in order?
>>
>> Or, is there a better way?
>>
>> Dave Smith
>>
>
>
.
- Follow-Ups:
- Re: Retrieving selected items from folder contents table
- From: Stephen Griffin [MSFT]
- Re: Retrieving selected items from folder contents table
- References:
- Retrieving selected items from folder contents table
- From: Dave Smith
- Re: Retrieving selected items from folder contents table
- From: Dmitry Streblechenko
- Retrieving selected items from folder contents table
- Prev by Date: Re: Retrieving selected items from folder contents table
- Next by Date: Re: Retrieving selected items from folder contents table
- Previous by thread: Re: Retrieving selected items from folder contents table
- Next by thread: Re: Retrieving selected items from folder contents table
- Index(es):
Relevant Pages
|