Import from outlook folder Results

When using Office 2003 I was able to import emails from an Outlook folder via the 'Get External Data' menu. This let me import into the same table each time.

However on Office2007 I have been trying to import them by the following steps:
External Data > More > Microsoft Outlook Folder
I select the table to import them into, and select the #Append a copy of the records to the table' option

This gives me the following message:

"Method 'Value'of object '_AccessProperty' failed"

Any ideas?

I keep all my contacts in Microsoft Outlook and use an Access Database to log call reports. Currently I am having to type in contact information in both areas, but would like it to link so I only have to do it once.

I have used the 'Import' from 'Outlook Folder' wizard under 'Get External Data' to create a linked table. However, my outlook contacts are not showing up in the database under 'Companies'. There are several different forms in this database.

Can someone please help me with this? I attached the access database. Attached Files Call Reports (1.48 MB, 22 views) Reply With Quote 10-07-2009, 01:04 PM #2 martyn Novice Windows XP Access 2003 Join Date Oct 2009 Posts 5 You can import from access to load Outlook contacts but I am not sure if there is a way to link these two. If you find a way, please let me know b/c I use outlook the same way. I just import every so often which works but there has to be a simpler method of maintaining and updating contact information.

OK, trying to import and attach emails from outlook to my access dBase.

have working code to do it, but need to give the user a way to only link emails related to a specific project.

I've been toying with the idea of using subfolders, ie emails related to job 096 live in the 096 subfolder in outlook. this will work but it would be NICE (lol!) if i could read all subfolders in outlook, present them in an access listbox and let the user pick which subfolders to add on the fly. having trouble finding code examples that do that, anyone got any or can point me in right direction? thanx in advance

I have a customer that wants to see the daily appointments from Outlook.

I got so far and then I get messages that says "Object dosen't support this property or method" The problem occures in the "rs(.." statements. I have not found any help relating to this problem. If there is, please point me to them.

Working with Office 2007 and windows XP.

	Function showCalendar(strAns1)

	Dim ol As Object
Dim olns As Object
Dim objFolder As Object
Dim objAllAppointment As Object
Dim objRecurPattern As Object
Dim db As Database, rs As Recordset
Dim Appointment As Object
Dim objOutlook As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
'Dim objRecurPattern As Outlook.RecurrencePattern
Set objOutlook = CreateObject("Outlook.Application")
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
Set objRecurPattern = objOutlook.CreateItem(olAppointmentItem)
'set up database to receive tasks
Set db = CurrentDb
Set rs = db.OpenRecordset("tblShowAllOutlookTasks", DB_OPEN_DYNASET)
' Set the Application object.
Set ol = New Outlook.Application
' Set the Namespace object.
Set olns = ol.GetNamespace("MAPI")
'Set the default appointment folder.
Set objFolder = olns.GetDefaultFolder(olFolderCalendar)
' Set objAllTasks equal to the collection of all Tasks.
Set objAllAppointment = objFolder.Items
' Loop through each Appointment.
For Each Appointment In objAllAppointment
If Appointment.Categories = "CBBEP" Then
rs("ProjectManagerID") = strAns1
rs("typeofrecord") = "A"
rs("olsubject") = Appointment.Subject
rs("olstartdate") = Appointment.Start
rs("olduedate") = Appointment.End
rs("olreminderonoff") = Appointment.ReminderSet
rs("Aduration") = Appointment.Duration
rs("Aalldayevent") = Appointment.AllDayEvent
rs("alocation") = Appointment.Location
rs("arecurrencetype") = Appointment.RecurrencePattern.RecurrenceType
rs("apatternEnddate") = Appointment.PatternEndDate
rs("patternstartdate") = Appointment.PatternStartDate
rs("AIsRecurring") = Appointment.IsRecurring
rs("AReminderMinutesBeforeStart") =  Appointment.ReminderMinutesBeforeStart
rs("AReminderTime") = Appointment.ReminderTime
rs("olnotes") = Appointment.Body
rs("olpriority") = Appointment.Importance
Else   'donothing
End If
Set rs = Nothing
Set db = Nothing
End Function



Eventually I would like to have a button on a form that will automatically create a text a tab limited text file to and get Outlook to put it into a contacts folder, I say do say like because I am sure it is possible. First I want to start the Export to a text file, I will worry about the Outlook side later.

Currently we have a number of queries that contains only email addresses that are exported as a tab limited text files to a folder and then imported to Outlook folders. The process works but is cumbersome.

The other issue is this is split database and I want some of the necessary queries hidden including the email mailing lists, so that the right click – Export is impossible if you can’t see the query.

I have queries (one is qryMembersEmail) that we use manually to start the procedure and I can’t hide it because it is needed to generate the text file. So the first thing is to have a button that generates the text file. Because the query does not include column heading is it possible to put in a first line in the text file (less confusion when you get to import into Outlook). Something like “EmailAddress” followed by the generated email addresses. The text file would go into a folder and overwrite the previous text matching text file.

I am a VBA novice so I am sorry if I come back with seemingly stupid questions.

Thanks for reading my post and I hope you can help.

I would like to send an email with a hyperlink to an Outlook folder. This is part of the code I have so far.

.Subject = "Inventory Adjustment Approval" 'Forms!frmMail!Subject

strBody = ""

.Body = strBody
.Importance = olImportanceHigh 'High importance

This does produce the text in the email, but it is not a hyperlink. I do have some sample code to create a hyperlink from a file that works, but something seems to be different for an outlook folder. Does anyone know how to make it work?


i currently have a spreedsheet which imports data from outlook mail box to the spreed sheet and then the sheet is linked to a table in access. is it possible for me to import the data directly to access leaving excel out of the equation.

this is the code in excel if it helps anyone

	Sub impETM()
Selection.Delete Shift:=xlUp
' Variable Declaration
Dim ns As NameSpace
Dim Inbox As MAPIFolder, user As String
Dim olookSpace As Outlook.NameSpace
Dim olookRecipient As Outlook.Recipient
Dim AllowedAcc As Outlook.Views
Dim i As Integer
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
i = 0
If Inbox.Items.Count = 0 Then
MsgBox "There are no messages in the Inbox.", vbInformation, _
"Nothing Found"
Exit Sub
End If
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set olookRecipient = ns.CreateRecipient("PENSION SERVICE TVP IPC STAR TEAM")
Set Inbox = ns.GetSharedDefaultFolder(olookRecipient, olFolderInbox)
Set adbox = Inbox.Folders("Requests")
Set outBox = Inbox.Folders("Requests")
mails = adbox.Items.Count
i = 0: mail = -1
' Extract Email Information
Do While i < mails
i = i + 1
With adbox.Items(i)
'set allowed
mail = mail + 1
Cells(mail + 1, 1).Formula = .SenderName
Cells(mail + 1, 2).Formula = .Body
'.Move (outBox)
End With
' Clean Up
Set adbox = Nothing
With Application
.Calculation = xlCalculationAutomatic
End With
Dim k As Integer
Dim foundRow As Boolean
k = 1
Do While foundRow = False
If Cells(k, 1).Value = "" Then
Cells(k, 2) = "stop"
foundRow = True
Else: k = k + 1
End If
Cells(1, 1).Select
Selection.Replace What:="1/1/4501", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Selection.Replace What:="=", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Cells(1, 1).Select
Cells(1, 26).Value = k
Application.Run "'Flexi Import.xls'!sortAdjusts"
End Sub

I have a problem importing into Outlook from Access. I managed to do this once but cannot do it following the same methods a second time. From my contacts folder in Outlook I open the Import and Export wizard and follow all the prompts but when I get to the stage where "the following actions will be performed" there is nowhere to allow me to select from contact information eg name, email address etc. This information is present in the access table but on this tab I am only given the options of importing from "calls" "contact types" and "switchboard items", none of which contain the basic name and email fields.
I was able to do this successfully just a few days ago but now cannot seem to. I am sure this is a simple thing but I have no idea how to make it work again.
If anyone can give me some pointers I would really appreciate it.


My requirements are fairly simple. I've been tasked with automating (or at least reducing manual input) a contact list creation system. - Currently Office Admin staff update an excel document by hand, very tedious not 100% accurate.

I've found software that will allow users to update their own contact details in AD, without compromising security/stability etc. assuming this is updated all users will have up-to-date details in Active Directory, and subsequently in the Outlook Global Address List, through MS Exchange 2003.

This means that information is available but not printable to admin teams (e.g., our head office team would like to search ALL employees (outlook, nailed!) but also have a print out of all Site specific staff for this site ordered and presented for quick reference when directing calls.)

so I've used SQL but not used Access much and am very new to this but a little research of my needs has led me to a handy tool in outlook 2007 (probably previous also):
External Data tab -> More -> outlook folder -> import the source... -> choose address book -> remove/customise fields as required -> import to table -> save import settings.

With the above presaved import settings non technical admin staff can run what is now in essence a report, filter and sort the data very quickly and powerfully, and press print. Job done in 5 minutes with up-to-date details.

the only problem with this is that while the system seems very powerful it doesn't pick up all information that is available in outlook address books, principally two fields are missing:
1. initials (I’m not sure why but these are important to be printed by the admin team)
2. Internal extension number (importance is self explanatory, in outlook this is available under a user's details -> phone/notes -> Business 2

I've looked and looked for further options and advise online but have hit a brick wall. Is there any way to add these two fields to an otherwise perfect query? So that a printout can be maintained easily and as automatically as possible?

Help would be gratefully received.



i would like to import outlook emails to access 2007 using late binding so i dont have to set ODBC connection or link tables.

i would like to import outlook folder "Inbox/SD" to access table 'tblOutlookSD"
simple subject and body is all i need from Outlook
i went through many forums but couldnt get anything to work, any help would be greatly appreciated

I am pretty new to Access 2000 (or any Access for that matter), but I was wondering if there is a way to extract certain data from a field. I have imported a table from an Outlook folder (we use Outlook to send out survey's), and the data I want to extract is a memo field with the contents of survey replies. At the bottom of the field is a CSV format line that looks like this:
CSV format:
It is the bottom line with the comma separated values enclosed in quotes. Is there any way to do this with a query; ie, is there any way using SQL to do a split by carriage return into some sort of an array? Or do I need to learn VBA and do it behind the scenes? Any help is greatly appreciated.

Gary B.

Good Afternoon All,

I have thankfully aquired the code below from this website The code allows me to run this macro in outlook and insert all of the emails in a folder I select into an access table.

When the macro runs the outlook folder list populates and allows you to select a folder. Once you select the folder and hit ok all of the emails are inserted into my "email" table in my Access database.

Can anyone get me on the right path so that I can go one step further and select individual emails and send them to the "email" table?

Looking at the code if I did one email, I would not need the loop. I am thinking I just need to make a few changes to make it a single email option.
But have no idea where to start!

PHP Code:
Sub ExportMailByFolder()  'Export specified fields from each mail  'item in selected folder.  Dim ns As Outlook.NameSpace  Dim objFolder As Outlook.MAPIFolder ' I think this needs to be changed  Set ns = GetNamespace("MAPI")  Set objFolder = ns.PickFolder ' I think this needs to be changed  Dim adoConn As ADODB.Connection  Dim adoRS As ADODB.Recordset  Dim intCounter As Integer  Set adoConn = CreateObject("ADODB.Connection")  Set adoRS = CreateObject("ADODB.Recordset")  'DSN and target file must exist.  adoConn.Open "DSN=OutlookData;"  adoRS.Open "SELECT * FROM email", adoConn, _       adOpenDynamic, adLockOptimistic  'Cycle through selected folder.  For intCounter = objFolder.Items.Count To 1 Step -1   With objFolder.Items(intCounter)   'Copy property value to corresponding fields   'in target file.    If .Class = olMail Then      adoRS.AddNew      adoRS("Subject") = .Subject      adoRS("Body") = .Body      adoRS("FromName") = .SenderName      adoRS("ToName") = .To      adoRS("FromAddress") = .SenderEmailAddress      adoRS("FromType") = .SenderEmailType      adoRS("CCName") = .CC      adoRS("BCCName") = .BCC      adoRS("Importance") = .Importance      adoRS("Sensitivity") = .Sensitivity      adoRS.Update     End If    End With   Next  adoRS.Close  Set adoRS = Nothing  Set adoConn = Nothing  Set ns = Nothing  Set objFolder = NothingEnd Sub 

Thank you for your time!!


I'm using the below code to import the contents of an outlook folder into an access 97 database but need to also capture any attachments. I'm thinking along the lines of saving the attachments to disk and recording the file path as a hyperlink in a field within the recordset. Although i've no idea how to do this.

Could anyone show me how to do this?

Thanks in advance.

Sub ExportMailByFolder()
'Export specified fields from each mail
'item in selected folder.
Dim ns As Outlook.Namespace
Dim objFolder As Outlook.MAPIFolder
Set ns = GetNamespace("MAPI")
Set objFolder = ns.PickFolder
Dim Dbase As DAO.Database
Dim Conn As DAO.Connection
Dim RS As DAO.Recordset
Dim intCounter As Integer

Set Dbase = OpenDatabase _
("C:Documents and Settings901639DesktopEmail test.mdb")
Set RS = Dbase.OpenRecordset("Email")
'Cycle through selected folder.
For intCounter = objFolder.Items.Count To 1 Step -1
With objFolder.Items(intCounter)
'Copy property value to corresponding fields
'in target file.
If .Class = olMail Then
RS("Subject") = .Subject
RS("Body") = .Body
RS("FromName") = .SenderName
RS("ToName") = .To
RS("Recd") = .ReceivedTime
RS("FromAddress") = .SenderEmailAddress
RS("FromType") = .SenderEmailType
RS("CCName") = .CC
RS("BCCName") = .BCC
RS("Importance") = .Importance
End If

End With
Set RS = Nothing
Set Conn = Nothing
Set ns = Nothing
Set objFolder = Nothing
MsgBox "Import Succesful"
End Sub


I need to import Outlook email in an Access 2007-database.

I found code how to read mails stored in the Inbox
Set golApp = Outlook.Application
Set gnspNameSpace = golApp.GetNamespace("mapi")
Set mapifolder = gnspNameSpace.GetDefaultFolder(olFolderInbox)
For Each item In mapifolder.Items
MsgBox item.Subject

Problem is that my mails are not stored in the Inbox. They are stored in a folder "Export" which I have created manually in my Outlook mailbox.

How can I access a non-default Outlook folder and retrieve its content?

Kind regards

Hi, maybe someone could help me. I am trying to import an Outlook Contact folder into an access table using VBA. Basically I just want to replicate what the wizard does aside from giving user's the option to name and assign fields to the table. I used Helen's code for exporting and it worked great, now I need to go the other way. Anyone have any clues? Thanks in advance.

I was wondering if anyone had code examples for emailing the contents of an entire folder? The folder can have multiple file types in it (excel, pdf, word, etc) but every file need to be linked to the Outlook e-mail that Access produces.

I was trying to use this, but it completely ignores this part of the code:

	Dim str_Source_Path As String
Dim str_File_Name As String

str_Source_Path = "C:Temp"

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(0)
Set SafeMail = CreateObject("Redemption.SafeMailItem")
Set SafeMail.Item = myItem

With SafeMail
    .Recipients.Add (Me.CSOA) ' Send To
    .Recipients.Add (strSendTo) ' test code
    .Subject = "A new Peer/Management Validation has been completed for SO #" & Me.SONbr & " by " & Me.Validator & " for " &
    .Body = "Validation Request - SO #" & Me.SONbr & vbNewLine _
     & "Customer Name: " & Me.CustNm & vbNewLine _
     & vbNewLine _
     & vbNewLine _
     & "Order Validation Completed: " & Me.CreateDt & vbNewLine _
     & "Total Time Taken to Validate: " & strTimeDiff & vbNewLine _
     & "http://sp-fin/sites/OMApp/AuditValidation/Forms/AllItems.aspx" & vbNewLine _
     & vbNewLine
End With

    'Loop and attach all files from this folder
    str_File_Name = Dir(str_Source_Path)
    Do While str_File_Name  ""
    SafeMail.Attachments.Add (str_Source_Path & str_File_Name)
        str_File_Name = Dir

With SafeMail
     .Importance = Outlook.olImportance.olImportanceHigh
End With

Set Utils = CreateObject("Redemption.MAPIUtils")
Set myOlApp = Nothing
Set SafeMail = Nothing
Set Utils = Nothing

Thanks for any help, been wracking my head searching every site I know of.

I need to get information from a MSAccess DB that i've made.
I have 2 forms. The main form has the following fields: Foto, Name and Birthday. The subform has the following fields: address, mobile phone, email.
I want to store into the field Mobile_Phone the information of Tlm (this is the field from the subform Contactos inserted in the Main Form).
I wrote the following code:

Dim olns As Object ' Outlook Namespace.
Dim cf As Object ' Contact folder.
Dim c As Object ' Contact item.
Dim ol As New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set cf = olns.GetDefaultFolder(olFolderContacts)

' Create a new Contact item.
Set c = ol.CreateItem(olContactItem)
' Specify which Outlook form to use.
c.MessageClass = "IPM.Contact"
c.FullName = Me.Nome -> this line works OK
c.Mobile_Phone = Contactos!Tlm -> this one does't work

What seems to be the problem?It has something to do with field types? Where can i get that information? Please help me!


I'm using the below code to import the contents of an outlook folder into an access 97 database but need to also capture any attachments. I'm thinking along the lines of saving the attachments to disk and recording the file path as a hyperlink in a field within the recordset. Although i've no idea how to do this.

Could anyone show me how to do this?

Thanks in advance.

Sub ExportMailByFolder()
'Export specified fields from each mail
'item in selected folder.
Dim ns As Outlook.Namespace
Dim objFolder As Outlook.MAPIFolder
Set ns = GetNamespace("MAPI")
Set objFolder = ns.PickFolder
Dim adoDbase As DAO.Database
Dim adoConn As DAO.Connection
Dim adoRS As DAO.Recordset
Dim intCounter As Integer

Set adoDbase = OpenDatabase _
("C:Documents and Settings901639DesktopEmail test.mdb")
Set adoRS = adoDbase.OpenRecordset("Email")
'Cycle through selected folder.
For intCounter = objFolder.Items.Count To 1 Step -1
With objFolder.Items(intCounter)
'Copy property value to corresponding fields
'in target file.
If .Class = olMail Then
adoRS("Subject") = .Subject
adoRS("Body") = .Body
adoRS("FromName") = .SenderName
adoRS("ToName") = .To
adoRS("Recd") = .ReceivedTime
adoRS("FromAddress") = .SenderEmailAddress
adoRS("FromType") = .SenderEmailType
adoRS("CCName") = .CC
adoRS("BCCName") = .BCC
adoRS("Importance") = .Importance
End If

End With
Set adoRS = Nothing
Set adoConn = Nothing
Set ns = Nothing
Set objFolder = Nothing
MsgBox "Import Succesful"
End Sub

Is it possible to Import Outlook Messages into an access database that have been archived on the network? I know I can move those messages into a folder on my Outlook application and Import it from there. What I really need to know is whether I can import from a network folder.

I have my database set up to import certain emails from my Outlook folders, and then break down the data in the emails into certain fields. This is done using a couple of queries. The problem is that the queries refuse to pass more than 255 characters of data for any of the fields. Two of the fields will almost always have more than this. Is there any way to set the field as a memo inside the query? I tried appending the data into a memo field in a table, but even though there was more than 255 characters, the query still treated the field as text and gave me a validation error. Is there any way around this? It has my whole project on hold right now.

Thanks in advance.

Not finding an answer? Try a Google search.