Solved

Outlook 2007 - How to automatically remove attachments from a large number of calendar items?

Posted on 2008-10-17
6
5,218 Views
Last Modified: 2012-05-05
The Vice President of our company has 120MB of Calendar items in his Exchange Outlook mailbox.  I believe the majority of this is caused by meeting attachments.  How can I quickly and easy remove all attachments from old meetings?  He is using Outlook 2007.
0
Comment
Question by:GxyAdam
6 Comments
 
LVL 23

Expert Comment

by:Kamaraj Subramanian
ID: 22743773
  1.   On the Tools menu, click on Instant Search, Advanced Find, or use the Ctrl-Shift-F combination on the keyboard.
   2. Under "Look For," the default is set to look for Messages. Change that to Appointments and Meetings.
   3. Leave the Search for the word(s) field blank.
   4. Click Find Now. You'll see all your Calendar events displayed in the pane below.
   5. Select all the appointments and meetings by using Ctrl-A.
   6. Press the Del key to delete all the events. Depending on how many events you have, it may take a while for Outlook 2007 to delete them so be patient.
0
 

Author Comment

by:GxyAdam
ID: 22743810
But that will delete the calendar event completely.  I would like to delete the attachment from the item while still keeping the record of the meeting.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
ID: 22744075
Hi, GxyAdam.

The code below will remove the attachments of all selected appointments.  Follow these instructions to use it.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on Module1
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
5.  Edit the code as needed.  I included comments wherever something needs to or can change
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Close Outlook
9.  Start Outlook
10. Select the old appointments
11. Run the macro

Sub RemoveAttachments()
    Dim olkItem As Object, intIndex As Integer
    For Each olkItem In Application.ActiveExplorer.Selection
        For intIndex = olkItem.Attachments.Count To 1 Step -1
            olkItem.Attachments.Item(intIndex).Delete
        Next
        olkItem.Save
    Next
    Set olkItem = Nothing
End Sub

Open in new window

0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:GxyAdam
ID: 22744469
That macro works great for removing attachments from e-mail messages.  However, I'm having difficulty applying this to calendar items.  If I bring up an Advanced Find window, select a calendar item, and run the macro - it will actually run the macro in the background on whatever e-mail message I have selected.  It does not run on the selected item in the foreground Advanced Find window.  If I can figure out another way to display calendar items like regular e-mail messages it will probably work.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 22744516
Switch the view on the calendar folder to All Appointments.  Then select the ones you want to run the macro against.
0
 
LVL 59

Assisted Solution

by:Chris Bottomley
Chris Bottomley earned 250 total points
ID: 22747477
Haven't tried Davids solution to know if it works in the calendar but have tried the following which works ... I leave any recurrent appointment attachments alone UNLESS the last date is before 'today'.

Chris
Sub delApptAttachments()
Dim apptCount As Integer
Dim olCal As Outlook.Folder
Dim appt As Outlook.AppointmentItem
Dim lngAppt As Long
Dim recur As Outlook.RecurrencePattern
Dim attCount As Integer
 
    Set olCal = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar)
    For lngAppt = 1 To olCal.Items.count
        If olCal.Items(lngAppt).IsRecurring = True Then
            Set recur = olCal.Items(lngAppt).GetRecurrencePattern
            If Not recur.NoEndDate And recur.PatternEndDate < Date Then
                For attCount = olCal.Items(lngAppt).Attachments.count To 1 Step -1
                    olCal.Items(lngAppt).Attachments(attCount).Delete
                Next
                olCal.Items(lngAppt).Save
            End If
        ElseIf CDate(olCal.Items(lngAppt).End) < Date Then
            For attCount = olCal.Items(lngAppt).Attachments.count To 1 Step -1
                olCal.Items(lngAppt).Attachments(attCount).Delete
            Next
            olCal.Items(lngAppt).Save
        End If
    Next
End Sub

Open in new window

0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question