D
deko
Id like to keep a Table in Access that lists all the dates on which an email
was sent or received to each contact. I keep the contacts in my Access
database synchronized with the Outlook Contact folder with code that runs
every time the database is open - I upload all the relevant contact info
(email address, etc.) and an Entity_ID (which goes in the "Department"
field) to the Outlook Contacts folder. What I need is a way to pull down
all the dates in "Sent" and "Received" fields in the InBox and Sent Items
folder - based on the Entity_ID in the Outlook Contacts form. Here's first
crack at it... any help is much appreciated.
Dim rst as DAO.Recordset
Dim db as DAO.Database
Dim olns as Outlook.Namspace
Dim os as New Outlook.Application
Dim ib, cn as Outlook.MAPIFolder
Dim objItems as Outlook.Items
Set olns = ol.GetNamespace("MAPI")
Set si = olns.GetDefaultFolder(olFolderSentItems)
set cn = olns.GetDefaultFolder(olFolderContacts)
Set objItems = cn.Items
Set rst = db.OpenRecordset("tblEmail")
For Each varId In cn.Items
'look up messages in Sent Items based on ID in Contacts folder
If cn.Items has email message in Sent Items folder Then
'(pseudo code)
varSent = DateSent
End If
'get dates from Sent Items folder based on ID and put into table
rst.AddNew
rst!Entity_ID = varId.Department
rst!Sent = DateValue(CDate(varSent))
rst.Update
Next
was sent or received to each contact. I keep the contacts in my Access
database synchronized with the Outlook Contact folder with code that runs
every time the database is open - I upload all the relevant contact info
(email address, etc.) and an Entity_ID (which goes in the "Department"
field) to the Outlook Contacts folder. What I need is a way to pull down
all the dates in "Sent" and "Received" fields in the InBox and Sent Items
folder - based on the Entity_ID in the Outlook Contacts form. Here's first
crack at it... any help is much appreciated.
Dim rst as DAO.Recordset
Dim db as DAO.Database
Dim olns as Outlook.Namspace
Dim os as New Outlook.Application
Dim ib, cn as Outlook.MAPIFolder
Dim objItems as Outlook.Items
Set olns = ol.GetNamespace("MAPI")
Set si = olns.GetDefaultFolder(olFolderSentItems)
set cn = olns.GetDefaultFolder(olFolderContacts)
Set objItems = cn.Items
Set rst = db.OpenRecordset("tblEmail")
For Each varId In cn.Items
'look up messages in Sent Items based on ID in Contacts folder
If cn.Items has email message in Sent Items folder Then
'(pseudo code)
varSent = DateSent
End If
'get dates from Sent Items folder based on ID and put into table
rst.AddNew
rst!Entity_ID = varId.Department
rst!Sent = DateValue(CDate(varSent))
rst.Update
Next