GetItemFromID finds too much

  • Thread starter Mark J. McGinty
  • 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
 
S

Sue Mosher [MVP-Outlook]

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.
 
M

Mark J. McGinty

Thanks very much, Sue, the Parent property was exactly what I needed.

-Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top