A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Read body of MailItem ?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 18th 06, 07:50 PM posted to microsoft.public.outlook.program_vba
Trey Shaffer
external usenet poster
 
Posts: 6
Default Read body of MailItem ?

I need to create a "Script" for a "run a script" rule action.

I am new to the Outlook object model, but familiar with VBScript.

I could use a pointer to some documentation, as I haven't found anything
clear and straightforward.

My immediate issue is accessing the body text of a message to evaluate the
contents.

I think the shortest question might be... What is the method/syntax to get
the body text, and what type of variable is it, string, collection, etc.?

I can work with it once I get a handle to it...

--
Trey Shaffer



Ads
  #2  
Old March 18th 06, 07:56 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Read body of MailItem ?

It's a string, Body.

Use this syntax for your "run a script" rule to avoid security prompts in Outlook 2003:

Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
' do stuff with olMail, e.g.
MsgBox olMail.Body

Set olMail = Nothing
Set olNS = Nothing
End Sub

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Trey Shaffer" wrote in message ...
I need to create a "Script" for a "run a script" rule action.

I am new to the Outlook object model, but familiar with VBScript.

I could use a pointer to some documentation, as I haven't found anything
clear and straightforward.

My immediate issue is accessing the body text of a message to evaluate the
contents.

I think the shortest question might be... What is the method/syntax to get
the body text, and what type of variable is it, string, collection, etc.?

I can work with it once I get a handle to it...

--
Trey Shaffer



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MailItem.Save for "Reply" [email protected] Add-ins for Outlook 0 March 5th 06 06:14 PM
How can I create a MailItem that displays like a received MailItem ? Clive Outlook - Using Forms 0 February 27th 06 04:14 PM
Losing handle to MailItem when send donald Add-ins for Outlook 8 February 1st 06 06:09 PM
Read Msgs Marked as Read? ERoss Outlook - General Queries 0 January 23rd 06 06:44 PM
dialog comes up when trying to access mailItem Neo Add-ins for Outlook 3 January 16th 06 09:56 PM


All times are GMT +1. The time now is 07:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.