Question Outlook .. unread messages

marvellous99

New member
Joined
Jun 16, 2008
Messages
1
Programming Experience
1-3
Hi All

I'm working on a simple application that
1) Reads all unread messages from outlook inbox folder, one by one.

2) Looks for attachments and saves them on a folder and runs an external
batch file.

3) Also, this application is supposed to mark that mail as unread and move it to deleted mail folder.

Part#1 i did using MAPIFolder.Items.Count and looping thru it.

Part# is done too.

Problem I have now is when the application does the part#3.
When it marks the mail as unread (or move to delete mail folder) the count (from part#1) is reset to current outlook values.
Also, Outlook wouldnt let me access the 1st and the last email on my current mail index.

I'm not sure if i explained it correctly, so i'll put an example below.
Example :
I have 4 unread messages in my inbox. Items.Count will show up 4 items.
I run this application, it now loops thru all 4 messages and does its stuff with attachments and marks the mail as unread.
Now Items.Count will show 3 items. So, obviously it wont give me a value for the 4th mailitem.
But, at the same time it also doesnt let me access the 1st mailitem. It give me an error ""Message you specified cannot be found"

Let me know if you need to see the code, i can post it here then.

TIA

@mod .. sorry for this being in the wrong section .. thanks for moving it to the correct one.
 
Last edited:
Back
Top