TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Microsoft > Microsoft Outlook

Notices

Archive only 'Read e-mails'

Microsoft Outlook


Reply
 
Thread Tools Display Modes
Old 16-01-2008, 06:36 PM   #1
Nabeel
Guest
 
Posts: n/a
Archive only 'Read e-mails'

Hi,


Is there a way to defined AutoArchiving to only archive read emails
older than a certain period?
  Reply With Quote
Old 16-01-2008, 06:38 PM   #2
Brian Tillman
Guest
 
Posts: n/a
Re: Archive only 'Read e-mails'

Nabeel <> wrote:

> Is there a way to defined AutoArchiving to only archive read emails
> older than a certain period?


That's exactly what AutoArchive does, with one exception: it doesn't
distinguish between read and unread. Any message whose modification date is
older than the archive date you choose will be archived.
--
Brian Tillman [MVP-Outlook]

  Reply With Quote
Old 16-01-2008, 06:39 PM   #3
JP
Guest
 
Posts: n/a
Re: Archive only 'Read e-mails'

One workaround would be to write some VBA code to set the "Do Not
Archive" flag on Read emails, then when you click on File>Archive,
uncheck "Include items with "Do not AutoArchive" checked." so those
emails would not be moved to archive.


HTH,
JP

On Jan 11, 9:16*am, Nabeel <> wrote:
> Hi,
>
> Is there a way to defined AutoArchiving to only archive read emails
> older than a certain period?


  Reply With Quote
Old 16-01-2008, 06:40 PM   #4
Nabeel
Guest
 
Posts: n/a
Re: Archive only 'Read e-mails'

I think you meant setting the 'Do Not archive' on 'unread emails'
and then there would be another piece of code to fire on the event
when the msg turns to 'read'.

anyone who can help with the code?

On Jan 12, 1:13*am, JP <> wrote:
> One workaround would be to write some VBA code to set the "Do Not
> Archive" flag on Read emails, then when you click on File>Archive,
> uncheck "Include items with "Do not AutoArchive" checked." so those
> emails would not be moved to archive.
>
> HTH,
> JP
>
> On Jan 11, 9:16*am, Nabeel <> wrote:
>
>
>
> > Hi,

>
> > Is there a way to defined AutoArchiving to only archive read emails
> > older than a certain period?- Hide quoted text -

>
> - Show quoted text -


  Reply With Quote
Old 16-01-2008, 06:41 PM   #5
JP
Guest
 
Posts: n/a
Re: Archive only 'Read e-mails'

You may want to post your question in microsoft.*public.*outlook.*
program_vba.

To get you started, you would need to check the ItemChange event for
your Inbox and see if the "Read" property of an email changes. If it
does, set the flag so it won't be archived. This code is a bit crude
so hopefully someone else will be able to refine it for you.

For example:

Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub Items_ItemChange(ByVal Item As Object)
If (Item.Class = olMail) And (Item.UnRead = False) Then
On Error Resume Next
' Msgbox "Setting do not archive flag now"
Item.NoAging = True
On Error Goto 0
End if
End Sub


HTH,
JP

On Jan 11, 4:27*pm, Nabeel <> wrote:
> I think you meant setting the 'Do Not archive' on 'unread emails'
> and then there would be another piece of code to fire on the event
> when the msg turns to 'read'.
>
> anyone who can help with the code?
>
> On Jan 12, 1:13*am, JP <> wrote:
>
>
>
> > One workaround would be to write some VBA code to set the "Do Not
> > Archive" flag on Read emails, then when you click on File>Archive,
> > uncheck "Include items with "Do not AutoArchive" checked." so those
> > emails would not be moved to archive.

>
> > HTH,
> > JP

>

  Reply With Quote
Old 16-01-2008, 06:41 PM   #6
JP
Guest
 
Posts: n/a
Re: Archive only 'Read e-mails'

Sorry that should be

Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim objNS As Outlook.NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub Items_ItemChange(ByVal Item As Object)
If (Item.Class = olMail) And (Item.UnRead = False) Then
On Error Resume Next
' Msgbox "Setting do not archive flag now"
Item.NoAging = True
On Error Goto 0
End if
End Sub


On Jan 11, 4:41*pm, JP <> wrote:
> You may want to post your question in microsoft.*public.*outlook.*
> program_vba.


  Reply With Quote
Old 16-01-2008, 06:41 PM   #7
Brian Tillman
Guest
 
Posts: n/a
Re: Archive only 'Read e-mails'

JP <> wrote:

> One workaround would be to write some VBA code to set the "Do Not
> Archive" flag on Read emails, then when you click on File>Archive,
> uncheck "Include items with "Do not AutoArchive" checked." so those
> emails would not be moved to archive.


But he wants to archive the read mail. He doesn't want to archive unread
mail. The VBA code should add the flag to unread items, not read items.
The problem I see with that, though, it that it would be all too esy to
forget to reenable archiving on the items as they become read. He's wind up
with nothing being archived as messages aged.
--
Brian Tillman [MVP-Outlook]

  Reply With Quote
Old 16-01-2008, 08:27 PM   #8
JP
Guest
 
Posts: n/a
Re: Archive only 'Read e-mails'

Apparently today is my day to repost code over and over! I think
the double negatives are throwing me off. Thank you Brian, here is the
revised (again) code. I do agree with you and suggest something better
to the OP, like posting to the other group (or not leaving emails
unread <grin>).

But as long as the emails are read from the Inbox, wouldn't it trigger
this code and (eventually) get the msg archived?


Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim objNS As Outlook.NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub Items_ItemChange(ByVal Item As Object)
If (Item.Class = olMail) And (Item.UnRead = False) Then
On Error Resume Next
' Msgbox "Setting do not archive flag now"
Item.NoAging = False
Else
Item.NoAging = True
On Error Goto 0
End if
End Sub


--JP


On Jan 11, 4:51*pm, "Brian Tillman" <tillman1...@yahoo.com> wrote:
>
> But he wants to archive the read mail. *He doesn't want to archive unread
> mail. *The VBA code should add the flag to unread items, not read items.
> The problem I see with that, though, it that it would be all too esy to
> forget to reenable archiving on the items as they become read. *He's wind up
> with nothing being archived as messages aged.
> --
> Brian Tillman [MVP-Outlook]


  Reply With Quote
Old 16-01-2008, 08:28 PM   #9
Nabeel
Guest
 
Posts: n/a
Re: Archive only 'Read e-mails'

Brian, JP,

Thanks for the code and the suggestion.


On Jan 12, 7:03*am, JP <jp2...@earthlink.net> wrote:
> Apparently today is my day to repost code over and over! I think
> the double negatives are throwing me off. Thank you Brian, here is the
> revised (again) code. I do agree with you and suggest something better
> to the OP, like posting to the other group (or not leaving emails
> unread <grin>).
>
> But as long as the emails are read from the Inbox, wouldn't it trigger
> this code and (eventually) get the msg archived?
>
> Private WithEvents Items As Outlook.Items
> Private Sub Application_Startup()
> Dim objNS As Outlook.NameSpace
> Set objNS = Application.GetNamespace("MAPI")
> Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
> End Sub
> Private Sub Items_ItemChange(ByVal Item As Object)
> If (Item.Class = olMail) And (Item.UnRead = False) Then
> * *On Error Resume Next
> * *' Msgbox "Setting do not archive flag now"
> * *Item.NoAging = False
> Else
> Item.NoAging = True
> * *On Error Goto 0
> End if
> End Sub
>
> --JP
>
> On Jan 11, 4:51*pm, "Brian Tillman" <tillman1...@yahoo.com> wrote:
>
>
>
>
>
> > But he wants to archive the read mail. *He doesn't want to archive unread
> > mail. *The VBA code should add the flag to unread items, not read items.
> > The problem I see with that, though, it that it would be all too esy to
> > forget to reenable archiving on the items as they become read. *He's wind up
> > with nothing being archived as messages aged.
> > --
> > Brian Tillman [MVP-Outlook]- Hide quoted text -

>
> - Show quoted text -


  Reply With Quote
Old 10-02-2009, 01:09 AM   #10
Unregistered
Guest
 
Posts: n/a
Re: Archive only 'Read e-mails'

Did you ever refine the code to meet your exact needs? I need the exact same thing :-)

Thanks,
Ray
  Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 06:30 PM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional