Can I activate automatic downloading of e-mails to a network path?

Veronica Tufi 20 Reputation points
2024-08-30T14:15:32.9633333+00:00

We are in possession of a pec address.

We would like to know whether it is possible with "Outlook" to automatically download messages to a folder located on a specific network path.

Is this possible via a VBA script? If yes, do you have a guide for us to follow?

Thanks in advance

Outlook | Windows | Classic Outlook for Windows | For business
0 comments No comments
{count} votes

Accepted answer
  1. Joan Hua-MSFT 5,300 Reputation points Microsoft External Staff
    2024-09-02T02:50:55.5233333+00:00

    Hi @Veronica Tufi

    Welcome to our forum!

    Here is a guide to help you set this up:

    1. Open Outlook and Access VBA Editor: Press Alt + F11 to open the Microsoft Visual Basic for Applications (VBA) editor.
    2. Insert a New Module: In the VBA editor, go to Insert > Module to create a new module.

    Copy and Paste the VBA Script: Copy the following VBA script and paste it into the new module window:

    Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
        Dim oAttachment As Outlook.Attachment
        Dim sSaveFolder As String
        sSaveFolder = "\\YourNetworkPath\YourFolder\" ' Replace with your network path
        For Each oAttachment In MItem.Attachments
            oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
        Next
    End Sub
    

    Replace \\YourNetworkPath\YourFolder\ with the actual network path where you want to save the attachments.

    1. Set Up an Outlook Rule: After creating the VBA script, you need to set up an Outlook rule to run the script automatically:
      • Go to Home > Rules > Manage Rules & Alerts.
      • Click on New Rule and select Apply rule on messages I receive.
      • Choose the conditions for the rule (e.g., from a specific sender or with specific words in the subject).
      • In the Select action(s) step, choose run a script and select the SaveAttachmentsToDisk script you created.
      • Complete the rule setup by following the prompts.
    2. Save and Test: Save the VBA script and the rule. Send a test email with an attachment to see if it is automatically saved to the specified network path.

    This script will save all attachments from incoming emails to the specified network path. If you need to save the entire email message, you can modify the script accordingly.

    Hope it helps! 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  

    Note: Please follow the steps in our [documentation] to enable e-mail notifications if you want to receive the related email notification for this thread. 

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.