SharePoint 2013 Read Outlook Emails and Add Email Content in SharePoint List

office 365 save email to sharepoint

In this article, we will explore how to read an email in Outlook and add the content of the email body to a SharePoint List in SharePoint 2013. We can achieve this by writing a C# console application using Microsoft Exchange Web Services.

New to Office 365 SharePoint Online? Get Office 365 Enterprise E3 Subscription & Try out all the features

If we talk about a requirement, let’s take a part of an HR Portal in which an HR sends some information about newly joined employees to, let’s say, admin team via an E-mail. Then, the admin team stores the information of each employee in the SharePoint List manually.

We are writing a console application here where every email with Employee details will be creating an item in the SharePoint List and the fields of the item will be obtained from the email body. Make sure, the format of the email body is structured as demonstrated below in the last image.

The console application can be scheduled via Windows Scheduler to run every 5 minutes to check the incoming emails in Outlook.

Please follow the below steps for more detailed information.

Make sure that you have Microsoft Exchange Web Services installed and running. If you do not have Exchange Web Services, you might get an error during compilation.

using Microsoft.Exchange.WebServices.Data;
using MEWS=Microsoft.Exchange.WebServices.Data;

Follow the below steps for installation:
Once you have created a console application and added all the required references, right click on References and click “Manage NuGet Packages…”

insert outlook email to sharepoint 2013
insert outlook email to sharepoint 2013

It will open the NuGet Package Manager. Search for “Microsoft.Exchange.WebServices” and when found, select those and click Install.

how to copy email from outlook to sharepoint
how to copy email from outlook to sharepoint

Read some SharePoint 2013 tutorials below:

Code Implementation:
Create the object of the Exchange Service and provide your Exchange Service credentials. Link your Mailbox with the Exchange Service Object.

ExchangeService oews = new ExchangeService(ExchangeVersion.Exchange2010_SP1)
Credentials = new WebCredentials(“akashkumhar”,”password123″,”domainname”)
}; oews.AutodiscoverUrl(“”);

Here, I have created two folders under Inbox – LetterBox and SuccessfulItems.

save email to sharepoint 2013
save email to sharepoint 2013

– LetterBox – It contains all the Emails which are to be parsed and processed.
– SuccessfulItems – It contains all the Emails for which the corresponding items are created successfully in the SharePoint List.

The application is designed in such a way that when you send an email to the linked Exchange Email ID, the Inbox rule moves the email received with subject “EmailReader” to the LetterBox so, that the intended emails are only parsed by the code and not the emails in the Inbox.

The console application reads all the unread emails from LetterBox, creates the items in SharePoint list, and moves them to Successful Items.

Make sure the email body is standard for all the emails, as shown below.

office 365 save email to sharepoint
office 365 save email to sharepoint

I have created an Employee list with the below columns and data types for demonstration.

save email to sharepoint online
save email to sharepoint online

The LetterBox is parsed for all the unread emails and the data is picked from Email body to be added into the corresponding columns.

I have done a successful implementation of this functionality. Check the below-created list items.

save my email attachments to a sharepoint document library
save my email attachments to a sharepoint document library

If I go ahead and show you the “Edit” form of one item, you could see how the field values are correctly placed at their respective fields.

insert outlook email to sharepoint online
insert outlook email to sharepoint online

When you deal with a “Choice” column which is a Checkbox with multiple option values, then you need to handle it differently than other columns. This will consider each option separated by commas as different and mark the checkboxes correctly.

NOTE – Please refer the entire code in the attachment from here.

I hope this article was helpful to you.

Check out Best Alternative to InfoPath -> Try Now


(Installation & Features)

About Akash Kumhar

I am Akash Kumhar a SharePoint Consultant.

View all posts by Akash Kumhar →