Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disable expiry date on groups of emails? (Outlook2003)

    I have hundreds of project emails-that had an expiry date set automatically two years back or so; now, two years later they show up as expired and all appear gray and in strike-out. I want to undo that for groups of mails belonging to projects still running.
    I can right click on each email and either disable or re-set the expiry date followed by a save to get rid of this. That works fine but only for one email at a time.
    Would there be some code that allows this for whole directories in my Personal Folders (PST) files? (VB, VBA - I know e.g. Excel well enough to implement something in there, more logical maybe would be Outlook VBA, or just maybe there's a little tool/program?)

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Disable expiry date on groups of emails? (Outl

    <P ID="edit" class=small>(Edited by JohnBF on 24-Jan-07 08:58. )</P>There doesn't seem to be an object to uncheck the Expiry date flag, nor have I found a VBA method to select the "None" option that appears in the Calendar drop down. This sub should work for setting the expiry date well into the future, with items selected in a Folder View - however I don't have any expired items to test it on, so it may not be correct:

    Sub ResetExpiryDate()
    Dim itm As Object
    If TypeName(Outlook.ActiveWindow) = "Explorer" Then
    For Each itm In Outlook.ActiveExplorer.Selection
    If itm.Class = olMail Then
    itm.ExpiryTime = #12/31/2099 11:59:59 PM#
    itm.Save
    Next itm
    Next itm
    End If
    End Sub
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable expiry date on groups of emails? (Outl

    <P ID="edit" class=small>(Edited by ErikJan on 24-Jan-07 18:11. )</P>OK, if you replace the first "Next Itm" by "End If" it works.

    Two little things:
    (1) This cycles only over the SELECTED items, not over the whole folder chosen
    (2) In stead of re-setting the expiry date to 2099, could I not "disable" it? It I try and get the property value, I get "01-Jan-4501" which is 949998 and if I set that, the checkmark is gone :-)

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Disable expiry date on groups of emails? (Outl

    Sorry about the missing end if. Good find on that maximum date. I'll modify the code for an entire folder and post back.
    -John ... I float in liquid gardens
    UTC -7ąDS

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Disable expiry date on groups of emails? (Outl

    Test this:

    Sub ResetExpiryDate2()
    Dim itmsInFolder As Outlook.Items
    Dim lngC As Long
    Set itmsInFolder = ActiveExplorer.CurrentFolder.Items
    For lngC = itmsInFolder.Count To 1 Step -1
    With itmsInFolder(lngC)
    If .Class = olMail Then
    .ExpiryTime = #1/1/4501#
    ' .Save
    End If
    End With
    Next lngC
    Set itmsInFolder = Nothing
    End Sub

    If it works, uncomment the '.Save line and go for it.
    -John ... I float in liquid gardens
    UTC -7ąDS

  6. #6
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable expiry date on groups of emails? (Outl

    <P ID="edit" class=small>(Edited by ErikJan on 25-Jan-07 14:34. )</P>Works!! Added some user interaction (note that the SAVE is still disabled!)

    Little additional question: I see now also that some (all?) emails are flagged (grey flag), can I also see this and disable the flag if it's grey?
    <font color=red>>> OK, its FLagStatus en FlagIcon
    Strange because BOTH are zero in my case, still the autoview has "flagged" emails show up as purple and ALL are purple...????</font color=red>

    <pre>Sub ChangeExpiryDate()
    'Adjust or reset expiry dates in Outlook folder
    Dim itmsInFolder As Outlook.Items
    Dim lngC As Long, NewDateI As String, NewDate As Date
    If vbNo = MsgBox("This will adjust the message-expiry on all emails in this folder." & vbCrLf & _
    "Do you want to continue?", vbYesNo + vbExclamation, "ExpiryDate Tool") Then Exit Sub
    '
    NewDateI = InputBox("Give the required new expiry-date." & vbCrLf & _
    "1 to disable expiry date (use with care!)" & vbCrLf & _
    "or format: dd/mm/yyyy", "ExpiryDate Tool")
    NewDateI = Trim(NewDateI)
    If NewDateI = "" Then
    Exit Sub 'Pressed cancel
    ElseIf NewDateI = "1" Then
    NewDate = #1/1/4501#
    ElseIf Len(NewDateI) = 10 And Mid(NewDateI, 3, 1) = "/" And Mid(NewDateI, 6, 1) = "/" Then
    NewDate = CDate(NewDateI)
    Else
    MsgBox "Syntax error in provided expiry-date", vbOKOnly + vbCritical, "ExpriyDate Tool"
    Exit Sub
    End If
    '
    Stop
    Set itmsInFolder = ActiveExplorer.CurrentFolder.Items
    For lngC = itmsInFolder.Count To 1 Step -1
    With itmsInFolder(lngC)
    If .Class = olMail Then
    .ExpiryTime = NewDate
    ' .Save
    End If
    End With
    Next lngC
    Set itmsInFolder = Nothing
    End Sub
    </pre>


  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disable expiry date on groups of emails? (Outl

    Below the line

    .ExpiryTime = NewDate

    insert this:

    .FlagStatus = olNoFlag

    (This will clear the flag unconditionally)

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disable expiry date on groups of emails? (Outl

    I think the displayed flags will only be cleared if you save the items.

  9. #9
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable expiry date on groups of emails? (Outl

    <P ID="edit" class=small>(Edited by ErikJan on 25-Jan-07 14:57. )</P>Works too.. thanks!

    Sorry (I was too quick), when I apply the OlNoFlag (which is zero) [and save of course], nothing changes: the email remains purple (which means: Flagged in my view). Ideas?

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disable expiry date on groups of emails? (Outl

    This is strange - it worked for a while for me, but now it doesn't any more if the item is flagged but not yet completed. If the item is marked as completed, the code will remove the check mark. I'm <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disable expiry date on groups of emails? (Outl

    Try this:

    .FlagStatus = olNoFlag
    .FlagIcon = olNoFlagIcon

  12. #12
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Disable expiry date on groups of emails? (Outl

    You guys get up too early!

    .FlagStatus = olNoFlag

    has always worked for me, but you might also see what happens with:

    .FlagStatus = olFlagComplete

    I don't have items to test this on, but that may be necessary if a .FlagDueBy Due Date was set. The .FlagDueBy should be cleared when the flag is removed.
    -John ... I float in liquid gardens
    UTC -7ąDS

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disable expiry date on groups of emails? (Outl

    Lazy Americans! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    .FlagStatus = olNoFlag used to work for me, but now, although it does change the value of FlagStatus, it doesn't clear the flag display. But setting FlagIcon does work (this property was introduced in Outlook 2003)

  14. #14
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable expiry date on groups of emails? (Outl

    Doesn't work yet.

    I set the .FlagStatus to zero (is the same as olNoFlag) and also the .FlagIcon (is the same as olNoFlagIcon). The message subject line stays purple.

    So I manually checked all properties in this specific email: all seems OK (so the above must have worked).

    So, in Outlook I go to "Views", then "Arrange By", then "Current View" then "Customize Current View". Here I click "Automatic Formatting".
    There is an entry there called "Flagged" (which is checked). The formatting is purple (so... this is where it happens!).
    I select the entry and click "Condition", there all is empty except in the "Advanced" tab. This one has ONE entry which lists:
    "Flag Status" "equals" "Flagged"

    Seems logical for a "Flagged" condition I'd say... (and yes, if I un-select the Flagged condition, the purple coloring disappears).

    I'm adding a picture to this post with a screen grab from the flags and the coloring on my system. I think that being gray means that the Flag is actually OFF indeed.
    So maybe we are doing everything right. Question then still remains why Outlook feels the email is "Flagged"....
    Attached Images Attached Images

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disable expiry date on groups of emails? (Outl

    I'm sorry, I have no further ideas. Moreover, I won't be able to test in Outlook 2003 for a few days.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •