.Net Outlook Inbox Folder Question Getting 1st Message problem.

  • Thread starter Thread starter Roger
  • Start date Start date
R

Roger

All,

I have some code that is executed when a "New E-mail" arrives. When
executing this code on several different machines I get either the New
Message or the Last Message. All machines are running same version of
Outlook 2003 SP1.

On one machine Visual Studio .Net is installed. On this machine I get the
last message when issuing the
molMi = molmfib.Items(1) instead of the New Message.

On the other machine I get the "New Message"...

Any explainationtions?

Here is what I am using to get the mail...

Dim molns As Outlook.NameSpace
Dim molmfib As Outlook.MAPIFolder
Dim molMi As Outlook.MailItem
Dim i As Integer
molns = m_Olapp.GetNamespace("MAPI")
molmfib =
molns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)

Visual Studio .Net PC
i = molmfib.Items.Count
molMi = molmfib.Items(i)
sSubTemp = molMi.Subject

'Other Machine Code to get New Message
molMi = molmfib.Items(1)

Thanks,

Rog
 
Hi Roger,

The problem could be how the messages are sorted in each Outlook. One
probably puts new messages at the top while the other puts them at the
bottom. I think you would need to loop through them and pull them off based
on date or on the property that shows whether or not they were already read.
I've never worked with Outlook so I don't know what those properties are. A
quick look at the object model should tell you. Good luck! Ken.
 

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

Back
Top