PC Review


Reply
Thread Tools Rate Thread

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

 
 
=?Utf-8?B?SmFzb24gRmVycmVl?=
Guest
Posts: n/a
 
      31st Mar 2005
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.olFolderInbox)

'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


 
Reply With Quote
 
 
 
 
Crouchie1998
Guest
Posts: n/a
 
 
Reply With Quote
 
=?Utf-8?B?SmFzb24gRmVycmVl?=
Guest
Posts: n/a
 
      31st Mar 2005
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
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
inbox messages older than 3 days are deleted from my inbox how do. LJ Microsoft Outlook Discussion 1 21st Apr 2010 04:50 PM
Email messages get stuck in my inbox despite repairing inbox =?Utf-8?B?S3lsZSBIYWluZXM=?= Microsoft Outlook Discussion 4 11th Jan 2006 10:04 PM
merged inbox folder from computer to lapton, now inbox messages are missing erin.dorsett@idbois.ang.af.mil Microsoft Outlook 1 22nd Jul 2004 03:34 PM
New messages don't show in inbox till I leave inbox?? Jim Rodgers Microsoft Outlook 1 5th Aug 2003 12:43 AM
Loop through messages in inbox Eric W. Microsoft Outlook VBA Programming 1 1st Jul 2003 01:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:03 PM.