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 to read the header of e-mail message in Exchange 2003 by usingVBS?

Reply
 
Old 09-25-2008   #1 (permalink)
esska


 
 

How to read the header of e-mail message in Exchange 2003 by usingVBS?

Hello,
Does anybody know how to read the details of one single message by
using VBS script?
I am trying to write a script which will be reading single e-mail. I
really need basic information about library which should be used in
Exchange 2003.

Regards,
esska

My System SpecsSystem Spec
Old 09-25-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: How to read the header of e-mail message in Exchange 2003 by using VBS?

esska wrote:
Quote:

> Hello,
> Does anybody know how to read the details of one single message by
> using VBS script?
> I am trying to write a script which will be reading single e-mail. I
> really need basic information about library which should be used in
> Exchange 2003.
How do you identify which message to deal with, or will there be only one in
the inbox? I use code similar to below to read all messages in an Outlook
inbox:
==========
' Retrieve Outlook Inbox folder.
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNameSpace.GetDefaultFolder(6)

' Enumerate messages in Inbox.
lngCount = objFolder.Items.Count

For k = 1 To lngCount
Set objItem = objFolder.Items(k)
' Number of attachements.
intAttach = objItem.Attachments.Count
For j = 1 to intAttach
' Name of attachment.
strFile = objItem.Attachments.Item(j).FileName
Next
' Body of message.
strBody = LCase(objItem.Body)
' HTML message.
On Error Resume Next
strHTMLBody = LCase(objItem.HTMLBody)
If (Err.Number <> 0) Then
strHTMLBody = ""
End If
On Error GoTo 0
' Size of message
lngSize = objItem.Size
' Received time of message.
strReceived = objItem.ReceivedTime
' Message subject.
strSubject = objItem.Subject
Next
=======
This example displays nothing, it just demonstrates how to retrieve some
information. It also only retrieves the messages in the user's own inbox,
assuming Outlook is installed and configured on the computer. You can search
the web for more information on Outlook.Application, or inquire in an
Outlook or Exchange newsgroup.

I have seen code that enumerates all mailboxes in Exchange and documents
mailbox size and number of messsages. That looks similar to:
=======
strComputer = "MyServer"
Set objWMI = GetObject("winmgmts:\\" & strComputer &
"\root\MicrosoftExchangeV2")
Set objMbxs = objWMI.ExecQuery("SELECT * FROM Exchange_Mailbox",,48)
For Each objMbx In objMbxs
Wscript.Echo objMbx.MailBoxDisplayName _
& ", " & objMbx.Size & "KB, " & objMbx.TotalItems & " items"
Next
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 10-01-2008   #3 (permalink)
esska


 
 

Re: How to read the header of e-mail message in Exchange 2003 byusing VBS?

On 25 Wrz, 17:28, "Richard Mueller [MVP]" <rlmueller-
nos...@xxxxxx> wrote:
Quote:

> esska wrote:
Quote:

> > Hello,
> > Does anybody know how to read the details of one single message by
> > using VBS script?
> > I am trying to write a script which will be reading single e-mail. I
> > really need basic information about library which should be used in
> >Exchange2003.
>
> How do you identify which message to deal with, or will there be only onein
> the inbox? I use code similar to below to read all messages in an Outlook
> inbox:
> ==========
> ' Retrieve Outlook Inbox folder.
> Set objOutlook = CreateObject("Outlook.Application")
> Set objNamespace = objOutlook.GetNamespace("MAPI")
> Set objFolder = objNameSpace.GetDefaultFolder(6)
>
> ' Enumerate messages in Inbox.
> lngCount = objFolder.Items.Count
>
> For k = 1 To lngCount
> * * Set objItem = objFolder.Items(k)
> * * ' Number of attachements.
> * * intAttach = objItem.Attachments.Count
> * * For j = 1 to intAttach
> * * * * ' Name of attachment.
> * * * * strFile = objItem.Attachments.Item(j).FileName
> * * Next
> * * ' Body of message.
> * * strBody = LCase(objItem.Body)
> * * ' HTML message.
> * * On Error Resume Next
> * * strHTMLBody = LCase(objItem.HTMLBody)
> * * If (Err.Number <> 0) Then
> * * * * strHTMLBody = ""
> * * End If
> * * On Error GoTo 0
> * * ' Size of message
> * * lngSize = objItem.Size
> * * ' Received time of message.
> * * strReceived = objItem.ReceivedTime
> * * ' Message subject.
> * * strSubject = objItem.Subject
> Next
> =======
> This example displays nothing, it just demonstrates how to retrieve some
> information. It also only retrieves the messages in the user's own inbox,
> assuming Outlook is installed and configured on the computer. You can search
> the web for more information on Outlook.Application, or inquire in an
> Outlook orExchangenewsgroup.
>
> I have seen code that enumerates all mailboxes inExchangeand documents
> mailbox size and number of messsages. That looks similar to:
> =======
> strComputer = "MyServer"
> Set objWMI = GetObject("winmgmts:\\" & strComputer &
> "\root\MicrosoftExchangeV2")
> Set objMbxs = objWMI.ExecQuery("SELECT * FROM Exchange_Mailbox",,48)
> For Each objMbx In objMbxs
> * * Wscript.Echo objMbx.MailBoxDisplayName _
> * * * * & ", " & objMbx.Size & "KB, " & objMbx.TotalItems & " items"
> Next
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab -http://www.rlmueller.net
> --
Thanks for answer.
I try to get header from Exchange Outlook Web Access (OWA). I cannot
see any header just, the information when the e-mail was sent. This
information is in BODY. I was wondering if is some class in vbscript
which may contain the delivery time.

Regards,
esska
My System SpecsSystem Spec
Old 10-02-2008   #4 (permalink)
esska


 
 

Re: How to read the header of e-mail message in Exchange 2003 byusing VBS?

The problem is with showing some parameters in e-mails. There is no
information about delivery, sent and receiving time. Does anybody know
how to see it? I was trying to do this by using OWA but if abybody
knows how to do this by Outlook or other sourse I would be grateful
for ANY help!

Regards,
esska

My System SpecsSystem Spec
Old 10-02-2008   #5 (permalink)
John J. Jobst


 
 

Re: How to read the header of e-mail message in Exchange 2003 by using VBS?

When viewing the message in Outlook, select the View menu then Options.
You'll see the message headers there, which contain the goodies you're
looking for.

"esska" <esska@xxxxxx> wrote in message
news:559cb77a-cde4-4739-8ab9-a5d4fa2955b7@xxxxxx
Quote:

> The problem is with showing some parameters in e-mails. There is no
> information about delivery, sent and receiving time. Does anybody know
> how to see it? I was trying to do this by using OWA but if abybody
> knows how to do this by Outlook or other sourse I would be grateful
> for ANY help!
>
> Regards,
> esska
>

My System SpecsSystem Spec
Old 10-06-2008   #6 (permalink)
esska


 
 

Re: How to read the header of e-mail message in Exchange 2003 byusing VBS?

Thanks for advice. I had to read the header direct from Exchange
server. I had to use OWA (there is no option to see internet headers).
The problem was resolved by using:
Const CdoPR_TRANSPORT_MESSAGE_HEADERS = &H7D001E

Like in simple Outlook.
Thanks for help

Regards,
esska

My System SpecsSystem Spec
Old 10-06-2008   #7 (permalink)
esska


 
 

Re: How to read the header of e-mail message in Exchange 2003 byusing VBS?

The problem was solved
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can I use Windows Mail to access my mail from MS Exchange 2003? Vista mail
Windows Live Mail: Header and message don't match Windows Live
Mail downloads header but not Body of message Vista mail
Header message changed in Windows mail Vista mail
Exchange 2003: Finding NDR e-mail addresses ? PowerShell


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