I am developing a scheduler program which will also read emails from MS Outlook. I am after a list of field names (such as SentOn, SenderName, To, CC, Subject, Body, Unread etc)
I have only found a few like the ones listed above. Does anyone have a list of the actual field names I can use for outlook email.
cheers
Tonez
If anyone is intested here is the code I use to just read the inbox only:
-----------------------------------------------------------------------
Public Function Scan_Inbox_only()
On Error Resume Next
Dim att_i As Integer
Dim rs1 As Recordset
Dim rsBOM As DAO.Recordset
Dim tmpstr As String
Dim OlApp As Outlook.Application
Dim Inbox As Outlook.MAPIFolder
Dim InboxItems As Outlook.items
Dim Item As Object
Dim Mailobject As Object
Dim item_att As Attachment
Set OlApp = CreateObject("Outlook.Application")
Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)
Set InboxItems = Inbox.items
'delete all existing email information
currentdb.Execute "DELETE * FROM UsysRef_Tmp_Email", dbFailOnError
currentdb.Close
If Inbox.items.Count = 0 Then
MsgBox "There are no messages in your Inbox.", vbInformation, "Nothing Found"
Exit Function
End If
Dim filename As String
'Now to process the inbox of the person using this database
' Check each message for attachments
For Each Mailobject In InboxItems
filename = ""
att_i = 0
'If InStr(1, Mailobject.Subject, "WAT") > 0 Then
For Each item_att In Mailobject.attachments
filename = filename & "; " & item_att.filename
att_i = att_i + 1
Next item_att
Set rs1 = currentdb.OpenRecordset("UsysRef_Tmp_Email", dbOpenDynaset)
rs1.AddNew
rs1![datesent] = Mailobject.SentOn
rs1![whosent] = Mailobject.SenderName
rs1![dateRecieved] = Mailobject.Received
rs1![Read] = iif((Mailobject.UnRead = True), "UnRead", "Read")
rs1![To] = Mailobject.To
rs1![CC] = Mailobject.CC
rs1![Subject] = Mailobject.Subject
rs1![Body] = Mailobject.Body
rs1![num_attachment] = att_i
rs1![name_attachment] = iif(Left(filename, 1) = ";", Right(filename, Len(filename) - 2), filename)
rs1.update
rs1.Close
Set rs1 = Nothing
Next
currentdb.Close
MsgBox ("Scan of Inbox completed")
End Function
I have only found a few like the ones listed above. Does anyone have a list of the actual field names I can use for outlook email.
cheers
Tonez
If anyone is intested here is the code I use to just read the inbox only:
-----------------------------------------------------------------------
Public Function Scan_Inbox_only()
On Error Resume Next
Dim att_i As Integer
Dim rs1 As Recordset
Dim rsBOM As DAO.Recordset
Dim tmpstr As String
Dim OlApp As Outlook.Application
Dim Inbox As Outlook.MAPIFolder
Dim InboxItems As Outlook.items
Dim Item As Object
Dim Mailobject As Object
Dim item_att As Attachment
Set OlApp = CreateObject("Outlook.Application")
Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)
Set InboxItems = Inbox.items
'delete all existing email information
currentdb.Execute "DELETE * FROM UsysRef_Tmp_Email", dbFailOnError
currentdb.Close
If Inbox.items.Count = 0 Then
MsgBox "There are no messages in your Inbox.", vbInformation, "Nothing Found"
Exit Function
End If
Dim filename As String
'Now to process the inbox of the person using this database
' Check each message for attachments
For Each Mailobject In InboxItems
filename = ""
att_i = 0
'If InStr(1, Mailobject.Subject, "WAT") > 0 Then
For Each item_att In Mailobject.attachments
filename = filename & "; " & item_att.filename
att_i = att_i + 1
Next item_att
Set rs1 = currentdb.OpenRecordset("UsysRef_Tmp_Email", dbOpenDynaset)
rs1.AddNew
rs1![datesent] = Mailobject.SentOn
rs1![whosent] = Mailobject.SenderName
rs1![dateRecieved] = Mailobject.Received
rs1![Read] = iif((Mailobject.UnRead = True), "UnRead", "Read")
rs1![To] = Mailobject.To
rs1![CC] = Mailobject.CC
rs1![Subject] = Mailobject.Subject
rs1![Body] = Mailobject.Body
rs1![num_attachment] = att_i
rs1![name_attachment] = iif(Left(filename, 1) = ";", Right(filename, Len(filename) - 2), filename)
rs1.update
rs1.Close
Set rs1 = Nothing
Next
currentdb.Close
MsgBox ("Scan of Inbox completed")
End Function