Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - How do IRead an Outlook Msg in vbScritp

Reply
 
Old 11-07-2008   #1 (permalink)
OldDog


 
 

How do IRead an Outlook Msg in vbScritp

Hi,

I want to look in my inbox and find mail from a specific sender and
then do stuf with the message.

So far I have this:

Set objOL = WScript.CreateObject ("outlook.application")
Set olNS = objOL.GetNameSpace("MAPI")
Set fld = olNS.GetDefaultFolder(6)

In fld I would expext to be able to select messages like this;

For Each item In fld <---- Error happens here

If item.SenderEmailAddress = "system.generated@xxxxxx" Then
WScript.Echo item.body
End If
Next

But i get this error:

Microsoft VBScript runtime error: Object doesn't support this property
or method

What should I do here?

OldDog


My System SpecsSystem Spec
Old 11-07-2008   #2 (permalink)
OldDog


 
 

Re: How do IRead an Outlook Msg in vbScritp

On Nov 7, 1:01*pm, OldDog <mikef2...@xxxxxx> wrote:
Quote:

> Hi,
>
> I want to look in my inbox and find mail from a specific sender and
> then do stuf with the message.
>
> So far I have this:
>
> Set objOL = WScript.CreateObject ("outlook.application")
> Set olNS = objOL.GetNameSpace("MAPI")
> Set fld = olNS.GetDefaultFolder(6)
>
> In fld I would expext to be able to select messages like this;
>
> *For Each item In fld * <---- Error happens here
>
> * * * * *If item.SenderEmailAddress = "system.genera...@xxxxxx" Then
> * * * * * * * * WScript.Echo item.body
> * * * * End If
> Next
>
> But i get this error:
>
> Microsoft VBScript runtime error: Object doesn't support this property
> or method
>
> What should I do here?
>
> OldDog
Found it. I need to go down another level,


Set objOL = WScript.CreateObject ("outlook.application")
Set olNS = objOL.GetNameSpace("MAPI")
Set fld = olNS.GetDefaultFolder(6)
set msg = fld.items '<------ right here

For Each item In msg

If item.SenderEmailAddress = "system.genera...@xxxxxx"
Then
WScript.Echo item.body
End If
Next

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Solved Exporting Email accounts from Vista to Microsoft Outlook or Outlook Express Microsoft Office
vbscritp Sql Impersonation VB Script
Importing back-up Outlook Express file with emails to Outlook 2007 and/or Windows Live Mail Vista mail
Transfert messages Outlook 2000 ou Outlook Express 6 vers Windows Mail Vista mail
Easiest way to transfer outlook 2003 settings (XP) to Outlook 2007 onnew vista machine? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46