Alan's Blog

"Yeah. I wrote a script that will do that."

Manage the Outlook Attachment Folder with PowerShell

Posted on 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

Filed under PowerShell, Scripting | No Comments »

Snooze via VBScript

Posted on 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.

Filed under Computing, VbScript | No Comments »

Outlook VBA: Reply to All as Text

Posted on 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
        Set rply = item.Reply
    End If

    item.Close olDiscard

    Set rply = Nothing
    Set item = Nothing
End Sub

Tags: ,
Filed under Computing | No Comments »

Outlook VBA: Snooze until one minute prior to start

Posted on 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

Tags: ,
Filed under Computing | No Comments »

Please Note

All the scripts are saved as .txt files. Newer files have a "View Script" button which will let you save or open a script in notepad. For earlier posts, the easiest way to download with IE is to right click on the link and use "Save Target As". Rename file from Name_ext.txt to Name.ext.

To see a full post after searching, please click on the title.

PowerShell Scripts were written with Version 3 or 4.

https connections are supported.

All new users accounts must be approved, as are comments. Please be patient. It is pretty easy to figure out my email address from the scripts, and you are welcome to contact me that way.

Site Search



SQL Site

Bad Behavior has blocked 262 access attempts in the last 7 days.