M
mkboynton via OfficeKB.com
I have the following code in my Outlook today page to list the emails in my
inbox and provide a link to open them. My question is how do I mark the
emails as read when I click on them?
<script language="VBScript" type="text/vbscript">
Function GetInboxSubjects()
Dim theApp
Dim theOLNS
Dim inboxFolder
Dim mSubject, MyArray, MyMsg
Set theApp = window.external.OutlookApplication
Set theOLNS = theApp.GetNameSpace("MAPI")
Set inboxFolder = theOLNS.GetDefaultFolder(6)
For Each InboxItem In inboxFolder.Items
'Check if message has been read or not
If InboxItem.UnRead = True then
TF = "No"
Else
TF = "Yes"
End If
'Email information table
mList = "<TABLE WIDTH='100%' BORDER='0' CELLPADDING='3' CELLSPACING='0'
FRAME='below' style='table-layout:fixed'><TR><TD WIDTH='25%' style='border-
color:black; border-width:0' nowrap><A HREF='outlook:inbox/"& InboxItem.
EntryID & "' title='Read " & InboxItem.Subject & "'>" & InboxItem.SenderName
& "</A></TD><TD WIDTH='43%' style='border-color:black; border-width:0'
nowrap><A HREF='outlook:inbox/"& InboxItem.EntryID & "' title='Read " &
InboxItem.Subject & "'>" & InboxItem.Subject & "</A></TD><TD WIDTH=25%'
style='border-color:black; border-width:0' nowrap>" & InboxItem.SentOn &
"</TD><TD WIDTH='7%' style='border-color:black; border-width:0' nowrap>" & TF
& "</TD></TR>" & mList
Next
'Header table
mList = "<TABLE WIDTH='100%' BGCOLOR='Silver' BORDER='1' CELLPADDING='3'
CELLSPACING='0' FRAME='rhs' style='table-layout:fixed'><TR><TD WIDTH='25%'
style='border-color:black; border-width:0'>Sender</TD><TD WIDTH='43%'
style='border-color:black'>Subject</TD><TD WIDTH='25%' style='border-color:
black; border-width:0'>Date</TD><TD WIDTH='7%' style='border-color:
silver'>Read</TD></TR></TABLE>" & mList
'Fill the <div>
document.getElementById("Subject").innerHTML = mList
'Update the table every 30 seconds
cTimer = setTimeout("GetInboxSubjects()",30000)
Set theApp = Nothing
Set theOLNS = Nothing
Set inboxFolder = Nothing
End Function
</Script>
inbox and provide a link to open them. My question is how do I mark the
emails as read when I click on them?
<script language="VBScript" type="text/vbscript">
Function GetInboxSubjects()
Dim theApp
Dim theOLNS
Dim inboxFolder
Dim mSubject, MyArray, MyMsg
Set theApp = window.external.OutlookApplication
Set theOLNS = theApp.GetNameSpace("MAPI")
Set inboxFolder = theOLNS.GetDefaultFolder(6)
For Each InboxItem In inboxFolder.Items
'Check if message has been read or not
If InboxItem.UnRead = True then
TF = "No"
Else
TF = "Yes"
End If
'Email information table
mList = "<TABLE WIDTH='100%' BORDER='0' CELLPADDING='3' CELLSPACING='0'
FRAME='below' style='table-layout:fixed'><TR><TD WIDTH='25%' style='border-
color:black; border-width:0' nowrap><A HREF='outlook:inbox/"& InboxItem.
EntryID & "' title='Read " & InboxItem.Subject & "'>" & InboxItem.SenderName
& "</A></TD><TD WIDTH='43%' style='border-color:black; border-width:0'
nowrap><A HREF='outlook:inbox/"& InboxItem.EntryID & "' title='Read " &
InboxItem.Subject & "'>" & InboxItem.Subject & "</A></TD><TD WIDTH=25%'
style='border-color:black; border-width:0' nowrap>" & InboxItem.SentOn &
"</TD><TD WIDTH='7%' style='border-color:black; border-width:0' nowrap>" & TF
& "</TD></TR>" & mList
Next
'Header table
mList = "<TABLE WIDTH='100%' BGCOLOR='Silver' BORDER='1' CELLPADDING='3'
CELLSPACING='0' FRAME='rhs' style='table-layout:fixed'><TR><TD WIDTH='25%'
style='border-color:black; border-width:0'>Sender</TD><TD WIDTH='43%'
style='border-color:black'>Subject</TD><TD WIDTH='25%' style='border-color:
black; border-width:0'>Date</TD><TD WIDTH='7%' style='border-color:
silver'>Read</TD></TR></TABLE>" & mList
'Fill the <div>
document.getElementById("Subject").innerHTML = mList
'Update the table every 30 seconds
cTimer = setTimeout("GetInboxSubjects()",30000)
Set theApp = Nothing
Set theOLNS = Nothing
Set inboxFolder = Nothing
End Function
</Script>