The approach is correct but I'd probably loop the table and not use GetRows
unless I was positive I was getting a limited number of rows back. I'd
either use GetRows(20) or GetRow, since MAPI has limitations on how much
data it can return in one pass.
EntryID is really a PT_BINARY property, so when you get it back you will
need to use HrArrayToString to convert it to a string value. If it's
possible that Exchange is involved you also have to ask for both the
short-term and long-term id's and check for an empty value on long-term
before checking for short-term. If you only have a PST file to query then
you can just use EntryID (PR_ENTRYID = 0x0FFF0102).
const int PR_ENTRYID = 0x0FFF0102;
const int PR_LONGTERM_ENTRYID_FROM_TABLE = 0x66700102;
Probably just for clarity I'd also Or the property type with the tag instead
of using an addition operator, but that's more a matter of style.
After you have the EntryID for an item retrieving the item is simple using
the NameSpace.GetItemFromID() method.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
wrote in message
ups.com...
Thank you very much for your response Ken
Yes, I am using Redemption, and I have tried to replicate the code on
this page
http://www.dimastr.com/redemption/ma...tablefiltering
to suit my c# project.
Now, what I need to do is to understand what I am supposed to do with
the result of this. I have investigated the "rows" variable, which
turns out to be a System.Array object including data from my
mailitems.
Here is my code:
int [] columns = new int[3];
Outlook.Items items = selectedFolder.Items;
Redemption.SafeMailItem safeMail = new Redemption.SafeMailItem();
safeMail.Item = items[1];
int cmTag = safeMail.GetIDsFromNames("{00020329-0000-0000-
C000-000000000046}", "Storage");
cmTag = cmTag + 0x001E;
columns[0] = cmTag;
cmTag = safeMail.GetIDsFromNames("{00020329-0000-0000-
C000-000000000046}", "RID");
cmTag = cmTag + 0x001E;
columns[1] = cmTag;
cmTag = safeMail.GetIDsFromNames("{00020329-0000-0000-
C000-000000000046}", "Account");
cmTag = cmTag + 0x001E;
columns[2] = cmTag;
Redemption.MAPITable mapiTable = new Redemption.MAPITable();
mapiTable.Item = items;
mapiTable.Columns = columns;
mapiTable.GoToFirst();
object rows = mapiTable.GetRows(mapiTable.RowCount);
Now, my next step is to decrypt the rows variable. I guess I have to
cast it to System.Array and try to get hold of the data in it.
Then I will have to iterate through the data, and pick up the
mailitems that fit my criteria and then do whatever I need to do with
them.
Can you verify to me that this is the right approach?
If you have a tip on how to include EntryID of messages to the columns
filter and how to get hold of the message by using this EntryID, I'd
appreciate it very much
Jørgen