472,780 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 software developers and data experts.

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

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.ol FolderInbox)

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
Nov 21 '05 #1
1 1166
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.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Roger" <da*****@netins.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.ol FolderInbox)

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

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: KS | last post by:
Hi, I have creatd a custom Outlook form with a few custom form fields. When completed the form is sent to me and goes into my Inbox. This works fine. Now Iam trying to write some code in...
2
by: Susan Bricker | last post by:
I have a routine that uses Late Binding to create a email and put it into the DRAFTS folder of Outlook. It only works if Outlook is already launched (Opened by me clicking on my desktop ICON...
7
by: Chris Thunell | last post by:
I'm trying to loop through an exchange public folder contact list, get some information out of each item, and then put it into a vb.net datatable. I run though the code and all works fine until i...
3
by: Lars Netzel | last post by:
I need to know if I can look for "Inbox" or as in Swedish "Inkorgen"... or can one asume I that the Inbox has a special index if I loop thru the folders? /Lars Netzel
0
by: Sanjay | last post by:
ho to all i am using this code Dim OuApp = New Outlook.ApplicationClass() Dim NSpace As Outlook.NameSpace Dim Fldrs As Outlook.Folders Dim subFldr As Outlook.MAPIFolder
2
by: | last post by:
Hi All, I know that Microsoft Exchange has a com interface, CDO, but I can't seem to find one for Microsoft outlook. does anyone have code snippets for using msoutlook and python, or suggestions?...
7
by: Dean Spencer | last post by:
Can anyone help? I am importing Emails from Outlook using the following code: Public Function ScanInbox(SubjectLine As String) Dim TempRst As Recordset Dim OlApp As Outlook.Application Dim...
5
by: =?Utf-8?B?YW5rdQ==?= | last post by:
Hey folks, I have created two empty.pst files and it created two empty folders both named "Personal Folder". This is fine, but my problem is I have two .pst files, p1 and p2. I want to move...
2
by: bill | last post by:
I have this code to get to the default Outlook inbox but I would like to get to the inbox of an additional added mailbox. Can this be done? Here is the code I'm using below: Dim objSession As...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.