Solved

I need to extract the contents of a mailbox to a CSV file (Dates,Subject,From, To, Body)

Posted on 2008-10-24
4
326 Views
Last Modified: 2011-10-03
My boss requires the ability to export the contents of a mailbox to a CSV file, I have tried using Outlook, but it does not include dates and times in the export.
I have tried using get external data with access and the infromation level is correct, but there is only 65000 characters a row.
Right clicking and saving the email gives the right data, but not in a usable format
Could anyone suggest  a way of doing this?
Thanks
Mike
0
Comment
Question by:mikesjn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:isdi
ID: 22795282
Hello Mike,

My suggestion is to write a script using VBS or an application using some language that can instantiate COM objects to extract the data as required.
0
 

Author Comment

by:mikesjn
ID: 22795387
Have you any code samples, I can do very basic VBS, but I am lost after that. Someone suggested PERL, but they may as well have said Latin.
Thanks
Mike
0
 
LVL 1

Accepted Solution

by:
isdi earned 500 total points
ID: 22807013
Hello Mike,

Save the code snippet with the '.vbs' extension. Execute it from the command line. You should first be asked to allow the script access to your email. Then you should see five message boxes showing some of the email.

This should get you started.
You'll also have to learn how to write data to a file. Search for 'File System Object'.  Search Google and msdn.microsoft.com

I don't know this site but this page talks briefly about the process:
http://www.activecallcenter.com/manual/306.htm

Here is a google search that should help:
http://www.google.com/search?num=100&hl=en&safe=off&q=vbs+Outlook+Email+Read&btnG=Search

In essence there are several things you will have to learn about *or* you will have to hire someone that knows about them.

All the above is just enough to get you started, but if you can write basic VBS then it should not be too much of an issue.


-isdi-
Dim oOutlook
Dim oNamespace
Dim oInbox
Dim oItem
Dim sTemp1 
Dim iLimit
 
Const olFolderInbox = 6
 
	SET oOutlook = CreateObject("Outlook.application")
	SET oNamespace = oOutlook.GetNameSpace("MAPI")
	SET oInbox = oNamespace.GetDefaultFolder(olFolderInbox)
 
 
	For Each oItem in oInbox.Items
		If iLimit = 5 Then Exit For
			sTemp1 = "From:  " & oItem.SenderName & vbCrLf
			sTemp1 = sTemp1 & oItem.Subject & vbCrLf
			sTemp1 = sTemp1 & "Attachment Count = " & oItem.Attachments.Count & vbCrLf & vbCrLf 
			sTemp1 = sTemp1 & oItem.Body
			Msgbox sTemp1
			iLimit = iLimit + 1
	Next
 
	SET oInbox = Nothing
	SET oNamespace = Nothing
	SET oOutlook = Nothing

Open in new window

0
 

Author Closing Comment

by:mikesjn
ID: 31509583
Thanks for that, great help. Got it working.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question