none
Save attachment from outlook items in an outlook folder RRS feed

  • Question

  • Can someone help for that

    Apparently it's not possible even using vba

    Easy to save to local drive but impossible to Outlook folder

    Many thanks for your help

    Friday, November 20, 2015 3:10 PM

Answers

  • Hi ews,

    Did your original issue about saving attachments has been resolved? If it has been resolved, I suggest you mark the helpful reply as answer to close this thread. And if you have new issues, I suggest you post a new thread and share us more information about your error.

    Thanks for your understanding.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, November 25, 2015 6:33 AM

All replies

  • See Attachment.SaveAsFile and Application.CopyFile

    You could use a VBA macro to save an attachment as a file and then copy that file into an Outlook folder.

    Friday, November 20, 2015 4:22 PM
  • Do you mean you are trying to create a DocumentItem object and add an attachment to it? You can call MAPIFolder.Items.Add("IPM.Document"), then add an attachment (DocumentItem.Attachments.Add) followed by DocumentItem.Save.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, November 20, 2015 5:27 PM
  • Hello,

    There is no trivial way for keeping attachments in Outlook folders. You can store only Outlook items in the folder, not files. You may consider saving attached files to the disk (see the SaveAsFile method of the Attachment class) and displaying files using Windows forms controls placed on an adjacent window. See Creating Adjacent Windows In Outlook for more information. Or just use Advanced Outlook view and form regions , for example:

    Friday, November 20, 2015 7:22 PM
  • I would like to save items attachments from email

    exemple xls doc file and then save them in a subfolder in the inbox(only attachement)

    Sue Mosher said in a psot it's not possible directly

    we should copy to local file then reimport

    Do you agree or do you have a code for me to test

    many thanks

    Saturday, November 21, 2015 11:47 AM
  • What version of Oulook do you use?

    The following simple macro was used in Outlook 2013 to import an Excel spreadsheet from an attachment into the "Imports" subfolder of the inbox using the VBA functions I mentioned in my earlier post.  It uses the file system folder identified by the Temp environment variable as a work area and  creates a DocumentItem object in the Outllook folder.

    It is a proof of concept only and does not include error checking.

    Sub FImport()
    Dim m As MailItem
    Dim a As Attachment
    Dim inf As Folder
    Dim p As String
    Dim d As DocumentItem
    
    Set m = Application.ActiveExplorer.Selection.Item(1)
    
    If m.Attachments.Count > 0 Then
    
    Set a = m.Attachments(1)
    
    p = Environ("Temp")
    
    p = p & "\" & a.FileName
    
    a.SaveAsFile (p)
    
    Set d = Application.CopyFile(p, "Inbox\Imports")
    
    End If
    
    End Sub
    

    • Edited by RLWA32 Saturday, November 21, 2015 12:52 PM
    • Proposed as answer by RLWA32 Sunday, November 22, 2015 12:50 PM
    Saturday, November 21, 2015 12:09 PM
  • many thanks

    i'm using outlook 2010

      i have a folder called"  toto "  with 4 email with attachment

    Another called "momo"   both under inbox

    i need to save to momo attachement from toto items

     thanks

    Sunday, November 22, 2015 12:13 PM
  • You can change the sample VBA macro that I provided to fit your needs.  For example, change the name of the string in the Application.CopyFile function from "Inbox\Imports" to "Inbox\momo". 

    The sample macro will create a DocumentItem from the first attachment for whatever email message is selected in the Active Explorer Window.  After making the change to the subfolder name, all you would need to do is to navigate in the Explorer to the "toto" folder, select an email message that has an attachment and run the macro.

    Sunday, November 22, 2015 12:31 PM
  • many thanks for you really I appreciate but the deal is to proceed automatically

    every time an email arrive in the toto folder the macro should run

    To be honenst i'm not  expert

    thanks a lot

    Sunday, November 22, 2015 12:39 PM
  • At this point you should consider hiring a consultant to provide the automatic solution that you desire if you do not wish to undertake the task yourself.
    Sunday, November 22, 2015 12:53 PM
  • i try to 

    I try

    :) thanks

    Sunday, November 22, 2015 12:57 PM
  • Sunday, November 22, 2015 1:09 PM
  • ok

    thanks all for your help

    completed and works fine with RLWA script's

    my issue was that it was using inbox and my f... outlook was in french and was instead of inbox boite au lettre ....

    so the script report errors every time

    thanks again  for all

     

    

    

    

    Monday, November 23, 2015 9:00 AM
  • Set a = m.Attachments(1)

    this report only first attachement

    waht about all attachement in a messgae

    thanks

    Monday, November 23, 2015 4:35 PM
  • As I indicated earlier, this was a proof of concept macro to demonstrate how to copy an attachment into an Outlook Folder.

    If you want to copy all attachments then you must include code to iterate through all items returned in the Attachments collection.  For each attachment you would execute the statements to do the copy.  You know how many attachments are there through Attachments.Count.

    Monday, November 23, 2015 5:48 PM
  • I have another issue

    i'm using a rule to run the macro for new arrival message

    Macro run but process all messages in the inbox.....

    any idea to avoid this

    Very helpfull

    thanks a lot

    Tuesday, November 24, 2015 2:32 PM
  • The initial question in this thread was answered a long time ago.

    I suggest you start a new thread for this new question and post the code that you are using

    Tuesday, November 24, 2015 2:45 PM
  • Please start a new thread and include your complete source code.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, November 24, 2015 2:45 PM
  • agree to proceed like that

    but after testing again and again  i can see that some isssue when outlook is closed

    Tuesday, November 24, 2015 4:28 PM
  • What is "some issue"? You need to be a lot more specific than that.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, November 24, 2015 10:29 PM
  • Hi ews,

    Did your original issue about saving attachments has been resolved? If it has been resolved, I suggest you mark the helpful reply as answer to close this thread. And if you have new issues, I suggest you post a new thread and share us more information about your error.

    Thanks for your understanding.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, November 25, 2015 6:33 AM