Posts Tagged ‘Outlook’

Manage the Outlook Attachment Folder with PowerShell

Wednesday, December 30th, 2015

If you are using Outlook, every attachment you have ever opened is still on your hard disk. To see these files, paste this into to the Windows “Run” command box:

What you will see is one or more sub-folders which contain the attachments from previously opened emails. These files take up unnecessary space. They may be a security risk (business or personal), and they may be the thing that saves you when you permanently deleted an email or overwrote the original text of an important document.

In my case, I was interested in selectively recovering drive space when I wrote Manage-OutlookAttachmentFolder.ps1.  I used Get-ChildItem (alias GCI to recursively enumerate “$env:UserProfile\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook\”.  The size is displayed both as length, and with a calculated column size with MB/GB etc.

The script requires PowerShell 3, as it uses Out-Gridview to display the results.  After selecting the files, you can choose to either move them or delete them.  I used New-Object System.Windows.Forms.FolderBrowserDialog to choose the destination folder for moves.

Script Text

Snooze via VBScript

Wednesday, May 25th, 2011

Snooze.vbs is the VBScript implementation of the VBA code I previously published to snooze pending Outlook reminders until 1 minutes before start time.

Outlook VBA: Reply to All as Text

Tuesday, May 24th, 2011

I am a messaging old-timer, going back to the days of PINE and ELM and RBBSMail.  I like to reply to message like this:

>You said
I reply.

Actually the old days the mail client did it by initials so it looked like this:

YS>You said
AK>I reply.

I get a lot of HTML mail, which I see a a waste of storage. I reply as text with the the following code:

Sub ReplyAsText()
    Dim rply As Outlook.MailItem
    Dim item As Outlook.MailItem
    Dim retval As Integer
   
    Set item = GetCurrentItem()
    item.BodyFormat = olFormatPlain
   
    retval = MsgBox("Reply to all as text? No is just sender.", _
    vbYesNoCancel + vbQuestion + vbSystemModal, _
    "Reply to All?")
   
    If retval = vbCancel Then Exit Sub
   
    If retval = vbYes Then
        Set rply = item.ReplyAll
    Else
        Set rply = item.Reply
    End If
   
    rply.Display

    item.Close olDiscard

    Set rply = Nothing
    Set item = Nothing
End Sub
									

Outlook VBA: Snooze until one minute prior to start

Tuesday, May 24th, 2011

I spend a lot of time on the phone for conference calls.  If I snooze until 5 minutes before I am too early.  0 minutes before and I am too late.  The following is VBA code to snooze open reminders until one minute prior to starting.  I put it into a module and mapped it to a button.

Sub SnoozeUntilOneMinute()
‘Delays all visible reminder until one minute before start

    Dim olApp As Outlook.Application
    Dim objRems As Outlook.Reminders
    Dim objRem As Outlook.Reminder
    Dim varTime As Variant

    Set olApp = New Outlook.Application
    Set objRems = olApp.Reminders
 
    For Each objRem In objRems
        If objRem.IsVisible = True Then
            varTime = DateDiff(“n”, Now(), objRem.item.Start) – 1
            objRem.Snooze (varTime)
            MsgBox “Snoozed ” & objRem.item.Subject & ” for ” & CStr(varTime) & ” minutes.”, vbApplicationModal + vbOKOnly + vbInformation, “Snooze”
        End If
    Next objRem

End Sub