473,414 Members | 1,697 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,414 software developers and data experts.

Process all items in inbox with VB.NET

I posetd this in one group, but got no response, so I'll try it in this one.

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
Jul 21 '05 #1
0 2232

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

Similar topics

3
by: bobdydd | last post by:
Hi Everybody I have an Access 2000 query that "sees" the Outlook 2000 Inbox. This works fine until an email arrives where the subject field is empty (Null) This causes a type mismatch...
4
by: Nathan Carroll | last post by:
Why am I able to use this in Outlook and not do the same from .Net. My problems centers around the Items in the xp version of below i used the interop references. Does something similar exist for...
12
by: Raymond Lewallen | last post by:
How to wait for a process to stop completion is my goal. Obviously, the looping while waiting for the HasExited property is not a solution.. but thats the best I can come up off the top of my...
2
by: Roger | last post by:
I am creating an application that will sit on a client pc and monitor the inbox. When an e-mail enters the inbox, then an even will be fired and I will then be able to process the mail. I have...
0
by: richardkreidl | last post by:
I setup the code below to fire off from an Outlook rule when an email arrives in the 'Inbox'. The code does work to a point. It does copy email messages when they arrive in the 'Inbox' to the...
2
by: hsuntn | last post by:
I am grabbing Outlook MailItems using the Items property on my Outlook inbox. When I iterate through them, I notice that they are not ordered in ReceivedTime or CreationTime order. For example, ...
0
by: Jason Ferree | last post by:
I posetd this in one group, but got no response, so I'll try it in this one. I am trying to loop through all messages in the inbox. To do something, in my case, look for and save attachments....
3
by: GayathriP | last post by:
This article discusses about how can we access the inbox through MAPI using C# .NET. It also discusses about how to store the attachment in the local directory, how to create a folder in the inbox ...
0
by: =?Utf-8?B?UGF1bEg=?= | last post by:
Hi, I am writing an application which (on user request) scans the Outlook inbox for messages and other items which are relevant in the user defined context. There are several code examples...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.