How to save outgoing email attachments in SharePoint library?

CodeTwo Exchange Rules Pro is the ultimate powerhouse tool in the hands of an Exchange administrator. On a very general level it lets you create rules that redefine email flow and modify email content in your organization.

A common example of the program’s application is extended control over server-level email signatures. There are, however, numerous other ways it can be utilized. In this article I will talk about one of them: archiving attachments from outgoing email in SharePoint server libraries. A feature that can prove very useful when it comes to monitoring what your users send to external recipients.

My environment

For the purpose of this presentation, I have prepared the following server environment:

Domain: example.com
Domain controller: DC.example.com
Exchange Server 2013 CU13 (EX2013.example.com)
SharePoint Server 2013 SP1 (SP2013.example.com)

All servers operated by Windows Server 2012 R2

I deployed a domain controller running Exchange 2013 in the internet.com domain, so that I can simulate email going out into the Internet.

An email organization connected to the Internet

Scenario

Imagine a scenario in which a Sales manager, in order to audit attachments sent by his or her department, wants to archive the attachments in a dedicated library on a SharePoint 2013 server. The additional requirements are that:

  • the collection should only apply to files with .doc, .docx and .pdf extensions
  • only emails traveling outside of the organization are to be audited
  • apart from the filename, saved attachments should also include the senders’ names

Infrastructure preparation

In order to meet the above requirements, the following IT infrastructure elements will be necessary:

– SharePoint server,
– Exchange server,
– CodeTwo Exchange Rules Pro software installed on the Exchange server,

1. Set up a new document library on the SharePoint server and give the Exchange Trusted Subsystem user write permissions to it.

List of permissions granted to a new SharePoint library

(In my example I created a new subsite named “Sales” with a new document library named “Sales External Attachments” inside it.)

A new library created in SharePoint

2. Start the WebDAV client service on the Exchange server. The protocol allows for managing files on www servers. With it enabled, Exchange will be able to access SharePoint libraries like standard network resources. Depending on the version of the operating system the WebDAV protocol client can be started by:

– Windows Server 2008/2008 R2 – in the Add Feature Wizard add the Desktop Experience feature

Windows Server 2008: Add Feature Wizard with the Desktop Experience feature highlighted

– Windows Server 2012/2012 R2 – in the Add Feature Wizard expand User Interface and Infrastructure and add the Desktop Experience feature

Windows Server 2012: Add Feature Wizard with the Desktop Experience feature highlighted

NOTE: The WebDAV client service needs to be installed on all Exchange servers running the Transport service. Specifically:

  • Exchange 2007 – Hub Transport servers,
  • Exchange 2010 – Hub Transport servers,
  • Exchange 2013 – Mailbox servers,
  • Exchange 2016 – Mailbox servers,

3. Once the WebDAV client service has been installed, go to the services.msc snap-in and start the WebClient service (remember to set the Startup type to Automatic):

Services snap-in with the WebClient entry highlighted

Having done all this, you should now be able to browse SharePoint libraries as UNC paths via Windows Explorer on all Exchange transport servers.

My example produced the below path:

\\sp2013\DavWWWRoot\Example\sales\Sales External Attachments (the key folder being DevWWWRoot)

A SharePoint library accessed via Windows Explorer

UNC paths are a common problem in SharePoint. If you get stuck, as a workaround, try mapping the SharePoint library as a network drive on Exchange.

SharePoint library as a mapped network drive

Note that, if you do this, the path will not include the DevWWWRoot folder. My example produced:

\\sp2013\Example\sales\Sales External Attachments

Configuration of Exchange Rules Pro

Once the infrastructure is ready, you can start to configure rules in CodeTwo Exchange Rules Pro. Let’s go over the requirements one more time:

  • the manager wants to archive attachments sent by Sales people in a dedicated library on a SharePoint server;
  • the collection should only apply to files with .doc, .docx and .pdf extensions;
  • only emails traveling outside of the organization are to be audited;
  • apart from the name of the attachment, saved filenames should also include the senders’ names.

Just to keep things in order, lets add one more requirement – the folder names should reflect the date on which the email was sent.

Here is what you have to do:

1. Create a new rule and fill out all the necessary information:

A new email rule in CodeTwo Exchange Rules Pro

2. In the Conditions tab define two conditions linked with an And operator (this way both have to be met for the rule to be applied):

  • The sender must belong to OU=Sales,
  • Message direction must be outgoing

Rule conditions in CodeTwo Exchange Rules Pro

(leave the Exceptions tab blank)

3. In the Actions tab add the Strip/dump attachments action:

Adding the Strip/dump attachments action in CodeTwo Exchange Rules Pro

4. The action lets you specify additional conditions which will have to be met by attachments. Our manager wanted to collect files with .doc, .docx and .pdf extensions only, so under If email contains select attachments with a specific extension:

Adjusting the Strip/dump attachments action's settings

and use the Add button to provide the extensions:

Using the Add button to add predefined file extensions

The .pdf extension is defined by clicking Add, Other and typing it in:

Providing the .pdf extension

The defined extensions will be displayed in the dialog window:

List of extensions in the Strip/dump attachments action

5. Next, configure the action:

Configuring the Strip/dump attachments action

Under then, choose save these attachments to disk, click Options and provide the path to which CodeTwo Exchange Rules Pro will save files.

Providing the target folder in which CodeTwo Exchange Rules Pro will save attachments

As mentioned before, my example path is:

\\sp2013\DavWWWRoot\Example\sales\Sales External Attachments

In the Target Folder Structure tab, configure the program to create folders named after the dates attachments are sent on…

Defining the target folder structure in CodeTwo Exchange Rules Pro

…and define the date format.

Defining the format of automatically created folder names

In the FileName Pattern tab, define the behavior in case a file already exists, and the default filename pattern. In this example the pattern will include the sender’s email address and the original filename.

Defining a custom filename pattern in the Strip/dump attachments action in CodeTwo Exchange Rules Pro

Having completed all of the above configuration steps, save the setup and test the rule.

Testing the rule

Let’s test the rule by sending an email to k.green[at]internet.com (in an external organization) with a .pdf file attached. The email will be sent by a user belonging to OU=Sales.

An example email with a PDF attachment

After the email is sent, the sales_report.pdf file should appear in the Sharepoint Sales External Attachments library in a folder named after the email send date:

 

A folder in a SharePoint library named after an email send date

Now let’s test the rule by sending an email from a different account belonging to the OU=Sales and attaching a .docx file to it.

An email with a DOCX file attached

The result:

Email attachments saved in a SharePoint library

Looks good. The Sales Manager can now perform real-time monitoring of attachments sent by his or her users to contacts located outside of the organization.

Conclusion

The scenario described in this article is only one of many ways CodeTwo Exchange Rules Pro can help an administrator.

To find out what else the application can do, download and play around with the free trial version: https://www.codetwo.com/exchange-rules-pro/download?sts=6357

How to save outgoing email attachments in SharePoint library? by

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

*