B
Blaine Fredrickson
I've managed to create code that will get all the e-mail
from my inbox using ado.
I can update some fields, and even delete the mail using
normal ado methods, but I can't find a way to mark the
mail as "read", or to change a "read" message back
to "unread".
Any ideas???
Here's the code:
Dim iMaxMsg As Integer, i As Integer
Dim sMsg As String
Dim adoconn As ADODB.Connection
Set adoconn = New ADODB.Connection
adoconn.ConnectionString
= "Provider=Microsoft.JET.OLEDB.4.0;Exchange
4.0;MAPILEVEL=Mailbox - WIP|;DATABASE=c:\temp;"
adoconn.Open
Dim adors As ADODB.Recordset
Set adors = New ADODB.Recordset
adors.Open "select [Inbox].* from [Inbox];", adoconn,
adOpenDynamic, adLockOptimistic
Do While Not adors.EOF
On Error Resume Next
sMsg = ""
For i = 0 To 20
sMsg = sMsg & i & adors.Fields(i).Name & " - " &
adors.Fields(i).Value & vbCrLf
Next i
MsgBox (sMsg)
'adors.Delete ' this will delete it
'adors.Fields(0).Value = 0 ' this will change the
priority
'adors.Update
adors.MoveNext
DoEvents
Loop
adors.Close
Set adors = Nothing
adoconn.Close
Set adoconn = Nothing
from my inbox using ado.
I can update some fields, and even delete the mail using
normal ado methods, but I can't find a way to mark the
mail as "read", or to change a "read" message back
to "unread".
Any ideas???
Here's the code:
Dim iMaxMsg As Integer, i As Integer
Dim sMsg As String
Dim adoconn As ADODB.Connection
Set adoconn = New ADODB.Connection
adoconn.ConnectionString
= "Provider=Microsoft.JET.OLEDB.4.0;Exchange
4.0;MAPILEVEL=Mailbox - WIP|;DATABASE=c:\temp;"
adoconn.Open
Dim adors As ADODB.Recordset
Set adors = New ADODB.Recordset
adors.Open "select [Inbox].* from [Inbox];", adoconn,
adOpenDynamic, adLockOptimistic
Do While Not adors.EOF
On Error Resume Next
sMsg = ""
For i = 0 To 20
sMsg = sMsg & i & adors.Fields(i).Name & " - " &
adors.Fields(i).Value & vbCrLf
Next i
MsgBox (sMsg)
'adors.Delete ' this will delete it
'adors.Fields(0).Value = 0 ' this will change the
priority
'adors.Update
adors.MoveNext
DoEvents
Loop
adors.Close
Set adors = Nothing
adoconn.Close
Set adoconn = Nothing