• Outlook 2016: Change location where received attachments are stored

    Home » Forums » AskWoody support » Productivity software by function » MS Outlook and email programs » Outlook 2016: Change location where received attachments are stored

    Author
    Topic
    #504892

    I am running Outlook 2016 (Office 365) under Windows 10. I would like Outlook to save all received attachments automatically to a single simple folder (where I can subsequently sort them out – moving some to their correct final locations, and deleting most others). [And yes, I realize this will break the link between the email message and the attachment. At present, it appears that Outlook “hides” the attachments in a mass collection of “user/appdata …” folders that are basically impossible to get to. For my needs, this is completely unacceptable. It also means that I *must* go through and manually move (save as) each individual attachment from the email view – which is frequently not practical.

    It should not be this hard to change. Either an Outlook option, or a registry edit should be the most that is required to change this – but for the life of me, I cannot find it. All I see is how to make Outlook change the “save as” default destination, and even that apparently no longer works. {:<(

    Any suggestions?

    Viewing 7 reply threads
    Author
    Replies
    • #1555989
    • #1555990

      See Outlook SecureTemp Files Folder[/url]. Outlook 2016 is version 16.0.

      Joe

      --Joe

      • #1555993

        See Outlook SecureTemp Files Folder. Outlook 2016 is version 16.0.

        Thanks, but both suggestions don’t seem to work, and aren’t addressing my problem. [But I seriously DO appreciate the suggestions.]

        Outlook 2016 seems to override the registry. I can set the change (as described above). However, the attachment is still put in the same place (upon receipt), and when opened, Outlook changes the registry edit back to some variation of right where it was before. [Saving the registry while Outlook is closed, and then opening Outlook, makes no difference. This is consistent with what I have seen elsewhere on the web – namely, that the old registry edit that worked through Outlook 2013, etc. no longer works.]

        But I must have explained my problem poorly anyway, because these all address either a) the default “save as” option on the attachment, or b) the securetemp folder that holds the file (copy) only while the attachment is open. What I am trying to change is where the attachment is automatically stored when it is RECEIVED! In other words, if I receive a bunch of emails (okay, mostly spam), and five have attachments, then I want to open a folder (such as D:Mail Attachments) – even without reading the emails – and see five files (the attachments) in there. I don’t want them scattered among thousands of hidden folders under APPDATA.

        Again, much appreciate the suggestions. Hopefully I have explained the problem better. tnx, jmk

    • #1556029

      Seems Joe’s suggestion should be what you need. I don’t know of any other way, tbh. Sorry.

      • #1556032

        Seems Joe’s suggestion should be what you need. I don’t know of any other way, tbh. Sorry.

        Unfortunately, no. [Although I did find the page interesting.] As you can see, it references the “secure temporary file folder.” For reasons the article explains, when you OPEN the attachment to an email, Outlook actually copies the attachment into a temporary (and ordinary) folder. This, the article, explains, allows anti-virus programs to have a shot at the attachment. The attachment *copy* is then deleted automatically when the attachment is closed. [With a couple of bugs, as explained in the article.]

        Sadly, this has nothing to do with my problem. Right now every received attachment (that is, when the email is first received) gets placed in a unique and special file and folder created when the email is received from the sender. You receive a 100 emails, each of which has attachments? Outlook creates 100 new folders!!!

        Worse (from my standpoint), each of these folders is not only hidden but basically unreachable by normal Windows Explorer actions. [There *are* ways, but nothing realistic for 100s or thousands of emails.]

        I just want it to stick my *incoming* email attachments in a single folder that can be opened like any other.

        Again, though – I really do thank every one for their suggestions and effort. I guess Outlook just doesn’t have anywhere near the capabilities of something like Eudora.

    • #1556041

      I suppose the only way with outlook would to be to run a script to do that. The script would have to be coded, of course, but it would definitely be possible.

    • #1556107

      There are various utilities that can do what you want; some free, but the best ones are paid:

      Many of these utilities will remove attachments from the email message and can replace them with links to the attachment on your hard drive,
      allowing you easy access to the attachment while keeping your mailbox or personal folders smaller.

      Attachment Management Tools for Outlook (at slipstick.com)

    • #1556111

      The following Outlook macros can be used to process a single message, a folder of messages, or by using the main macro as a script with a rule, automatically as the messages arrive. The messages are saved to a named folder, which is created if it doesn’t exist. No existing filename is overwritten.

      Code:
      Option Explicit
      
      Sub ProcessAttachment()
      ‘An Outlook macro by Graham Mayor
      Dim olMsg As MailItem
          On Error Resume Next
          Set olMsg = ActiveExplorer.Selection.Item(1)
          SaveAttachments olMsg
      lbl_Exit:
          Exit Sub
      End Sub
      
      Sub ProcessFolder()
      ‘An Outlook macro by Graham Mayor
      Dim olNS As Outlook.NameSpace
      Dim olMailFolder As Outlook.MAPIFolder
      Dim olItems As Outlook.Items
      Dim olMailItem As Outlook.MailItem
      Dim ofrm As New frmProgress
      Dim PortionDone As Double
      Dim i As Long
      
          On Error GoTo err_Handler
          Set olNS = GetNamespace(“MAPI”)
          Set olMailFolder = olNS.PickFolder
          Set olItems = olMailFolder.Items
          ofrm.Show vbModeless
          i = 0
          For Each olMailItem In olItems
              i = i + 1
              PortionDone = i / olItems.Count
              ofrm.lblProgress.Width = ofrm.fmeProgress.Width * PortionDone
              SaveAttachments olMailItem
              DoEvents
          Next olMailItem
      err_Handler:
          Unload ofrm
          Set ofrm = Nothing
          Set olNS = Nothing
          Set olMailFolder = Nothing
          Set olItems = Nothing
          Set olMailItem = Nothing
      lbl_Exit:
          Exit Sub
      End Sub
      
      
      Private Sub SaveAttachments(olItem As MailItem)
      ‘An Outlook macro by Graham Mayor
      Dim olAttach As Attachment
      Dim strFname As String
      Dim strExt As String
      Dim j As Long
      Const strSaveFldr As String = “D:PathReports”
      
          CreateFolders strSaveFldr
          On Error GoTo CleanUp
          If olItem.Attachments.Count > 0 Then
              For j = olItem.Attachments.Count To 1 Step -1
                  Set olAttach = olItem.Attachments(j)
                  If Not olAttach.FileName Like “image*.*” Then
                      strFname = olAttach.FileName
                      strExt = Right(strFname, Len(strFname) – InStrRev(strFname, Chr(46)))
                      strFname = FileNameUnique(strSaveFldr, strFname, strExt)
                      olAttach.SaveAsFile strSaveFldr & strFname
                      ‘olAttach.Delete        ‘delete the attachment
                  End If
              Next j
              olItem.Save
          End If
      CleanUp:
          Set olAttach = Nothing
          Set olItem = Nothing
      lbl_Exit:
          Exit Sub
      End Sub
      
      Private Function FileNameUnique(strPath As String, _
                                      strFileName As String, _
                                      strExtension As String) As String
      ‘An Outlook macro by Graham Mayor
      Dim lngF As Long
      Dim lngName As Long
          lngF = 1
          lngName = Len(strFileName) – (Len(strExtension) + 1)
          strFileName = Left(strFileName, lngName)
          Do While FileExists(strPath & strFileName & Chr(46) & strExtension) = True
              strFileName = Left(strFileName, lngName) & “(” & lngF & “)”
              lngF = lngF + 1
          Loop
          FileNameUnique = strFileName & Chr(46) & strExtension
      lbl_Exit:
          Exit Function
      End Function
      
      Private Function FileExists(filespec) As Boolean
      ‘An Outlook macro by Graham Mayor
      Dim fso As Object
          Set fso = CreateObject(“Scripting.FileSystemObject”)
          If fso.FileExists(filespec) Then
              FileExists = True
          Else
              FileExists = False
          End If
      lbl_Exit:
          Exit Function
      End Function
      
      Private Function FolderExists(fldr) As Boolean
      ‘An Outlook macro by Graham Mayor
      Dim fso As Object
          Set fso = CreateObject(“Scripting.FileSystemObject”)
          If (fso.FolderExists(fldr)) Then
              FolderExists = True
          Else
              FolderExists = False
          End If
      lbl_Exit:
          Exit Function
      End Function
      
      Private Function CreateFolders(strPath As String)
      ‘An Outlook macro by Graham Mayor
      Dim strTempPath As String
      Dim lngPath As Long
      Dim vPath As Variant
          vPath = Split(strPath, “”)
          strPath = vPath(0) & “”
          For lngPath = 1 To UBound(vPath)
              strPath = strPath & vPath(lngPath) & “”
              If Not FolderExists(strPath) Then MkDir strPath
          Next lngPath
      lbl_Exit:
          Exit Function
      End Function
      • #1556242

        Thanks, Graham.

        I got the basic code to work as a VBA script, then tried to move it to a rule. Didn’t have any trouble with that (in essence), including making the rule run every time a new message arrives. However, since the script expects an item to be selected, and arrived messages aren’t (apparently) automatically selected when the rule runs, it’s skipping everything.

        I can’t seem to find a list of designator terms for telling it to use “the current mailitem being processed.” Any ideas? tnx, jmk

    • #1556279

      I have marked the main sub as Private. Remove ‘Private’ from Private Sub SaveAttachments(olItem As MailItem). You should then be able to use that sub as a script attached to a rule. The rule should be something like:
      43912-Rule
      The rule will thus act on any message that fits the criteria i.e. with an attachment, that arrives in the Inbox. It doesn’t require an item to be ‘selected’.

    • #1556315

      Thanks… found the problem. When I extracted the “saveattachments” code, I somehow botched up the olItem reference. Need a few more tests, then sign it and move the security level back up. Then it should work like I want. Much appreciation to you, and to everyone else who took the time to answer.

    Viewing 7 reply threads
    Reply To: Outlook 2016: Change location where received attachments are stored

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: