GetItemFromID finds too much

  • Thread starter Thread starter Mark J. McGinty
  • Start date Start date
M

Mark J. McGinty

Greets,

I'm using GetItemFromID to locate items based on their (surprise surprise)
EntryID values (which I store in a db table and later retrieve, but that's
not important to this question.) I'm passing the folder ID of the folder I
expect them to be in, that I obtain from the EntryID property of the
MAPIFolder object (obtained by calling GetDefaultFolder.)

This all work well, except for one tiny thing: if the user has deleted an
item, and left it in the deleted items folder, the call to GetItemFromID
still finds it there, even though I've explicitly specified a folder in
which to search. This behavior seems anomalous to me, and as luck would
have it, directly undermines my algorithm (rarely, if ever, a good thing.)

So my question, is there a way force GetItemFromID to search in one folder
only? Or alternatively, is there a way to query an item to determine which
folder contains it?

tia,
-Mark
 
GetItemFromID doesn't care what folder the item is in, and provides no way
to specify that the search scope just one folder. Since you care about the
folder, you can check the item's Parent property to confirm whether it's
where you expect the item to be.
 
Back
Top