A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Mark as read



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 15th 09, 08:18 PM posted to microsoft.public.outlook.program_vba
mkboynton via OfficeKB.com
external usenet poster
 
Posts: 10
Default Mark as read

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'TRTD WIDTH='25%' style='border-
color:black; border-width:0' nowrapA HREF='outlook:inbox/"& InboxItem.
EntryID & "' title='Read " & InboxItem.Subject & "'" & InboxItem.SenderName
& "/A/TDTD WIDTH='43%' style='border-color:black; border-width:0'
nowrapA HREF='outlook:inbox/"& InboxItem.EntryID & "' title='Read " &
InboxItem.Subject & "'" & InboxItem.Subject & "/A/TDTD WIDTH=25%'
style='border-color:black; border-width:0' nowrap" & InboxItem.SentOn &
"/TDTD 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'TRTD WIDTH='25%'
style='border-color:black; border-width:0'Sender/TDTD WIDTH='43%'
style='border-color:black'Subject/TDTD WIDTH='25%' style='border-color:
black; border-width:0'Date/TDTD 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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200906/1

Ads
  #2  
Old June 16th 09, 05:56 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Mark as read

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)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"mkboynton via OfficeKB.com" 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'TRTD WIDTH='25%'
style='border-
color:black; border-width:0' nowrapA HREF='outlook:inbox/"& InboxItem.
EntryID & "' title='Read " & InboxItem.Subject & "'" &
InboxItem.SenderName
& "/A/TDTD WIDTH='43%' style='border-color:black; border-width:0'
nowrapA HREF='outlook:inbox/"& InboxItem.EntryID & "' title='Read " &
InboxItem.Subject & "'" & InboxItem.Subject & "/A/TDTD WIDTH=25%'
style='border-color:black; border-width:0' nowrap" & InboxItem.SentOn &
"/TDTD 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'TRTD WIDTH='25%'
style='border-color:black; border-width:0'Sender/TDTD WIDTH='43%'
style='border-color:black'Subject/TDTD WIDTH='25%'
style='border-color:
black; border-width:0'Date/TDTD 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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200906/1



  #3  
Old June 16th 09, 01:29 PM posted to microsoft.public.outlook.program_vba
mkboynton via OfficeKB.com
external usenet poster
 
Posts: 10
Default Mark as read

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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200906/1

  #4  
Old June 17th 09, 12:42 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Mark as read

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

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"mkboynton via OfficeKB.com" 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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200906/1



  #5  
Old June 17th 09, 08:15 PM posted to microsoft.public.outlook.program_vba
mkboynton via OfficeKB.com
external usenet poster
 
Posts: 10
Default Mark as read

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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200906/1

  #6  
Old June 17th 09, 09:59 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Mark as read

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

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"mkboynton via OfficeKB.com" 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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...g-vba/200906/1



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mark Sent as Read Dave Outlook and VBA 3 September 16th 08 03:02 PM
Mark sent items as read Nils M. Lunde Outlook - General Queries 4 September 30th 07 07:47 PM
Mark As Read JonWayn Outlook and VBA 1 January 25th 07 05:37 AM
Mark as read Sven Berg Outlook - General Queries 1 February 8th 06 09:20 AM
Mark as Read? After x seconds? HotRod Outlook - General Queries 2 January 12th 06 07:22 PM


All times are GMT +1. The time now is 07:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.