Mark as read

Status
Not open for further replies.
M

mkboynton

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


 
Have you tried to set teh Unread property to false?

Do not loop through all the messages in a folder. Use Items.Find/FindNext

Dmitry Streblechenko (MVP)

-

"mkboynton " <u10467@uwe> wrote in message

news:97a684095974e@uwe...
> 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
> >
>
>
 
Dmitry Streblechenko wrote:
> Have you tried to set teh Unread property to false?
> Do not loop through all the messages in a folder. Use Items.Find/FindNext
>
> >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

> [quoted text clipped - 59 lines]
> > End Function
> > </Script>


I have tried to set the Unread property to false using an onclick event, but

it seems to ignore the onclick since I have a <a href


 
What is the relevant snippet of your code? Do you call MailItem.Save?

Dmitry Streblechenko (MVP)

-

"mkboynton " <u10467@uwe> wrote in message

news:97af83df491db@uwe...
> Dmitry Streblechenko wrote:
> >Have you tried to set teh Unread property to false?
> >Do not loop through all the messages in a folder. Use Items.Find/FindNext
> >
> >>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

> >[quoted text clipped - 59 lines]
> >> End Function
> >> </Script>


> I have tried to set the Unread property to false using an onclick event,
> but
> it seems to ignore the onclick since I have a <a href
> >
>
>
 
Dmitry Streblechenko wrote:
> What is the relevant snippet of your code? Do you call MailItem.Save?
>
> >>Have you tried to set teh Unread property to false?
> >>Do not loop through all the messages in a folder. Use Items.Find/FindNext

> [quoted text clipped - 9 lines]
> > but
> > it seems to ignore the onclick since I have a <a href>


Here is what I have so far...it doen's even fire the MsgBox.

Sub MarkAsRead()

Dim theApp

Dim theOLNS

Set theApp = window.external.OutlookApplication

Set theOLNS = theApp.ActiveExplorer.Selection(1)

MsgBox "Marking as read"

If theOLNS.UnRead = True then

theOLNS.UnRead = False

theOLNS.Save

End If

Set theApp = Nothing

Set theOLNS = Nothing

End Sub


 
Which is a good indication that the MarkAsRead sub does not even get called,

right?

Dmitry Streblechenko (MVP)

-

"mkboynton " <u10467@uwe> wrote in message

news:97bfa27ab6127@uwe...
> Dmitry Streblechenko wrote:
> >What is the relevant snippet of your code? Do you call MailItem.Save?
> >
> >>>Have you tried to set teh Unread property to false?
> >>>Do not loop through all the messages in a folder. Use
> >>>Items.Find/FindNext

> >[quoted text clipped - 9 lines]
> >> but
> >> it seems to ignore the onclick since I have a <a href>


> Here is what I have so far...it doen's even fire the MsgBox.
> Sub MarkAsRead()
> Dim theApp
> Dim theOLNS

> Set theApp = window.external.OutlookApplication
> Set theOLNS = theApp.ActiveExplorer.Selection(1)

> MsgBox "Marking as read"

> If theOLNS.UnRead = True then
> theOLNS.UnRead = False
> theOLNS.Save
> End If

> Set theApp = Nothing
> Set theOLNS = Nothing

> End Sub

> >
>
>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
DoctorJellybean Outlook 365 doesn't always mark emails as read Using Outlook 3
Diane Poremsky Mark Sent Items as Read After Copying with a Rule Using Outlook 0
T Outlook 2013 either fails to mark messages as read or marks them as read, then un-marks them. Using Outlook 1
Mary B VBscript: Need to copy every email to a folder & mark that copy as read Outlook VBA and Custom Forms 5
C Mark all incoming emails as read Outlook VBA and Custom Forms 3
M How do I mark emails already received as read when I get a second, different email based on subject? Outlook VBA and Custom Forms 3
Z Mark moved copies as "Read" Using Outlook 19
Z "Mark All as Read" in Outlook 2007 extremely slow Using Outlook 1
H mark as read per folder options Using Outlook 1
A Mark all as read for public folders Using Outlook 14
N Changing the 'Mark item as read when selection changes' at runtime Outlook VBA and Custom Forms 1
B Move Sent Email to archival pst folder and mark as read - HOW TO Outlook VBA and Custom Forms 2
B Mark copy of sent email as read - VBA? Outlook VBA and Custom Forms 3
J Mark as read Outlook VBA and Custom Forms 2
T Setting a delegate to not mark items as read Using Outlook 9
Kika Melo How to mark as Junk any message not from Contacts (in Outlook.com) Using Outlook 3
K mark emails with colour manually (like in thunderbird) Using Outlook 1
V Macro to mark email with a Category Outlook VBA and Custom Forms 4
O Office 365 Outlook - mark to download Using Outlook 0
S Codes for "Mark Complete" the task Outlook VBA and Custom Forms 2
S Mark as Unread unless Categorized by Color Using Outlook 0
M Mark Complete keyboard shortcut... on a mac running Windows Bootcamp Using Outlook 0
T Adding "Mark As Complete" btton to Task Remindet Pop-Up Using Outlook 3
F Automatically close email after selecting mark unread Using Outlook 1
T outlook 2013 does not mark multiple forward messages as forward Using Outlook 2
7 Macro to mark message as junk and delete Outlook VBA and Custom Forms 3
V Mark BCC when emails is sent from specific account Outlook VBA and Custom Forms 2
B Outlook 2010: how to mark messages without opening? Eg for deletion Using Outlook 2
N Mark or follow up emails in shared mailbox Using Outlook 2
C Outlook 2010 search for question mark in calendar Using Outlook 7
M Can't mark appointments as private for other user Using Outlook 1
I Pound Symbol in emails show as � (black diamond with white question mark inside) - Office 2010. Using Outlook 11
J Pasting into Outlook 2003 produces blue question mark Using Outlook 2
R Macro to mark item unread Outlook VBA and Custom Forms 2
J Increase read pane font size, but NOT image size? Using Outlook 3
J Read Outlook Form fields Outlook VBA and Custom Forms 3
B Inconsistent handling of message read/unread status by Outlook Using Outlook 3
S E-mails marked as read turn back to unread after a couple of seconds Using Outlook 1
M Cannot read the calendar Using Outlook 9
Z Outlook 365 delete reminder you can’t make change to contents of this-read only folder Using Outlook 4
A Inbox didn't got read Outlook VBA and Custom Forms 0
e_a_g_l_e_p_i Is it possible it set the fonts used to read incoming mail Using Outlook 25
R seperate read layout to design in outlook 2016..Help!! Outlook VBA and Custom Forms 3
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
N Separate Read Layout Editing Outlook VBA and Custom Forms 0
A Read and Write to Text File Outlook VBA and Custom Forms 1
L Email Read and Delete Outlook VBA and Custom Forms 4
A Separate Read Layout Outlook VBA and Custom Forms 4
M Making Subject field writable (disable Read Only) Outlook VBA and Custom Forms 2
M How can I determine which user read an email Exchange Server Administration 4

Similar threads

Back
Top