Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    Pleasant Hill, CA
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatically save attachments to hard drive (2002/any)

    I

  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: Automatically save attachments to hard drive (2002/any)

    Can't be done with a Rule. You can write some code or use an attachment management tool such as those listed on Slipstick.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Posts
    93
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatically save attachments to hard drive (2002/any)

    Sarah,
    I have just been faced with the same problem from a colleague. In the end I wrote a VBA routine to promt for a directory path and then sequentially work through the selected messages, copying the attachments using a filename created from the sender's name, date/time sent and the attachment filename. This will work on any folder so long as you select the messages first.
    Here is the code if it is of any use:
    Sub attachment_save()
    On Error GoTo Problem
    Dim i, j As Integer
    Dim oSelectedItems As Outlook.Selection
    Dim oMessageItem As Object
    Dim sReport, sFilePath As String
    Set oSelectedItems = ActiveExplorer.Selection

    j = 0 ' This is the counter for the number of attachments procesed

    If oSelectedItems.Count = 0 Then
    MsgBox "No Move forms within the view are selected!", vbCritical, _
    "Attachment Stripper"
    Exit Sub
    End If

    sFilePath = InputBox$("Enter the directory path. This will be used for ALL the attachments" & _
    " in the message(s) you have selected.", "Attachment Stripper")
    If sFilePath = "" Then
    MsgBox prompt:="No directory path has been entered", Buttons:=vbExclamation
    Exit Sub
    End If
    For Each oMessageItem In oSelectedItems
    For i = 1 To oMessageItem.Attachments.Count
    oMessageItem.Attachments.Item(i).SaveAsFile sFilePath & "" & _
    oMessageItem.SenderName & " " & _
    FormatDateTime(oMessageItem.ReceivedTime, vbLongDate) & " " & _
    Hour(oMessageItem.ReceivedTime) & "-" & _
    Minute(oMessageItem.ReceivedTime) & " " & _
    oMessageItem.Attachments.Item(i).FileName
    j = j + 1
    Beep
    Next
    Next

    If i = 1 Then
    sReport = oSelectedItems.Count & " message containing " & j & _
    " attachments have been processed."
    End If
    If i > 1 Then
    sReport = oSelectedItems.Count & " messages containing " & j & _
    " attachments have been processed."
    End If

    MsgBox sReport, , "Report"
    GoTo GracefulEnd

    Problem:
    MsgBox prompt:="There has been a problem." & vbCrL & _
    "Please check the target directory exists and try again.", Buttons:=vbExclamation

    GracefulEnd:
    End Sub

    Regards,

    Paul

  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: Automatically save attachments to hard drive (2002/any)

    You may be interested in a technique provided by <!profile=JScher2000>JScher2000<!/profile>, which I use in my attachment save routine, to pop the Save Attachment dialog up:

    Dim cbtNSAF As CommandBarButton
    'set reference to the Save Attachments dialog
    Set cbtNSAF = ActiveInspector.CommandBars.FindControl(, 3167)
    'show the Save Attachments dialog
    cbtNSAF.Execute

    BUT popping the dialog box (in OL 2000) does not return anything, the coder has no way to recognize and handle a cancel or close without save.

    And just for grins, I have attached my custom button for the routine. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

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