Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to get E-mail body message

Status
Not open for further replies.

scriptnewbie

IS-IT--Management
Jul 22, 2005
16
US
Hi, I am not sure if this is possible, but I would like to get some help with writing script to get the first 3 lines of all Outlook email messages in a folder. Say I have folder contains all the messages that I need just the first 3 lines in the bodies (like they show up in the AutoPreview panel), and extract or export these first 3 lines and loop through all the emails in that folder then save the outputs to a text file. Any help would be greatly appreciated. Thank you.
 
This is easily possible through automation methods that Outlook exposes. Search this forum or google. I would like to point out that the first 3 lines will be different for different people depending on their screen resolution, font size, and how much of their screen they let the preview pane use.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thanks for your quick response TomThumbKP! before posting this message I did search this site as well as Google but could not find anything. Would you point me to the link or code that would accomplish this task. Thank you again for your help.
 
Here ya go:


Found this by doing a google search for "VBScript Outlook Automation" Then poking around on the first page returned.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thanks again Tom! However, searching for things in the Subject line is not what I wanted to do. As I mentioned before, I wanted to get the first 3 lines in the Message body and save them to a text file. and then loop through all the emails in the folder.
 
Well its not that big of a step to replace .Subject with the appropriate property to get the body instead. Try .Body. If you want someone to hand you a completely written script that does exactly what you want, this may not be the best place. If that is what you want, you should probably contact some of the consulting firms in your area. I'm sure they would be happy to hook you up with someone to do it for you. If instead you want to try to write it yourself, feel free to post what you have tried and explain what isn't working and I'm sure we can help you out here.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Thank you Tom! I am totally a script newbie and I am learning as I go along. That is why I was hoping that someone had done something similar to the task that I am doing. I really appreciate all your responses Tom. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top