473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How can I loop through all of the messages in the inbox - VB.NET E

I am trying to loop through all messages in the inbox. To do something, in
my case, look for and save attachments.
It is telling me that items is not a collection. I've tried everything I
can think of, I've even copied the code from a few sources (had to add
specific OOM in front of method names), Including Sues book, some code from
www.outlookcode.com, and one other place. but other than that, no change to
copied code. I think the problem is I've
looked at this so long that I just can't see the forrest for the trees
anymore. So... Any help anyone could provide would be most appreciated. Is
this a problem with Visual Studio? I can't find any reference to it anywhere.

OS: Windows 2000
Dev Env: Visual Studio.net 2003
(visual basic.net)
Outlook Version: Outlook 2000
(Utilizing outlook 9.0 Object Libarary
as reference to project)

Objective: Loop through all messages in inbox (for test) - eventually, from
another folder - but I have that figured out. Save attachments to disk, if
they exist. This is a subroutine of a bigger project, but, most of that is
working.

Problem: In the portion of the code, labeled ***PROBLEM***, it gives me the
following error:
"D:\Visual Studio Projects\waNOTIFICATION\Form1.vb(942): Expression is of
type 'Outlook.Items', which is not a collection type."
The code for the routine is below.

Private Sub btnProcessMsg_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnProcessMsg.Click
' Declare variables
Dim objApp As Outlook.Application
Dim ns As Outlook.NameSpace
Dim Inbox As Outlook.MAPIFolder
Dim Item As Object
Dim i As Integer

ns = objApp.GetNamespace("MAPI")
Inbox = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFol derInbox)

'PROBLEM IS HERE - THE NEXT LINE IS THE ONE
WITH THE ERROR -
'SPECIFICALLY - SQUIGGLY LINES UNDER INBOX.ITEMS
(SO IT IS NOT RECOGNIZING IT,
'OR IT IS, BUT IT THINKS ITS IN ERROR

For Each Item In Inbox.Items
'PROCESS MESSAGE HERE - GET SUBJECT, OR WHATEVER
Next Item
End Sub

Thank you in advance

Jason
Nov 21 '05 #1
2 5331
Crouchie:

Can't thank you enough, copying the code in the first article and pasting
it worked just like it should. I don't understand quite why, as the code I
was using came directly from a book, and worked in VBA, but not in .NET.
Must have something to do with how it was being initialized, or the way it
was put together. I thought it was maybe a bug in vb.net. Don't know why it
works, but at this point, don't care, and again.... Thank you

jf
"Crouchie1998" wrote:
Try these two:

http://support.microsoft.com/default...b;en-us;313795

http://support.microsoft.com/default...b;en-us;313800

Here is the best site for you though:

http://www.add-in-express.com/support/addin-vb-net.php

Nov 21 '05 #3

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

Similar topics

1
by: Raghul | last post by:
Is it posssible to read only the new messages or unread messages using imaplib in python? If it is possible pls specify the module or give a sample code. Thanks in advance
8
by: Brian Keating EI9FXB | last post by:
Would I be correct in saying that the only way to get a user message into a Windows form would be to use P/Invoke with Message? Of is there some part of the .NET API that I am totally un aware...
0
by: BL | last post by:
Hi all, I've got a number of sub-folders in my Outlook Express Inbox. I've also set up a number of message rules to make sure that email from particular individuals/organisations are moved to...
8
by: mtsweep | last post by:
Hi, I started a background thread to preform some time intensive tasks for a GUI frontend. This background thread uses a C++ object which requires a windows message loop so I started one in it...
5
by: =?Utf-8?B?RXJyb2w=?= | last post by:
I have messages in inbox.mbx from a CD copied from an old win 95 computer which I want to import to Win XP OE. Tried OE import, no go! The .mbx file type must be the problem. Is there a work around...
1
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Everyone, I am still having trouble with my hotmail inbox messages with the scroll bar..... I have a hotmail account ( Windows Live Beta), when I open my e-mails I sometimes would like to...
1
by: Perl Beginner | last post by:
Hello all, I'm coding in Perl. And I'm trying to figure out how to simply count the number of messages in an inbox folder that is already open. i've been playing around with Mail::Box::Manager,...
2
by: SteveC | last post by:
Hello, I am trying to use POP3_SSL class of the poplib module to read email from my gmail account. I can connect just fine using the example here http://www.python.org/doc/lib/pop3-example.html...
1
by: =?Utf-8?B?RGVsbCBVc2Vy?= | last post by:
Some how I lost my inbox, sent messages, deleted messages, etc. How do I get them back? Walt
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.