Microsoft Exchange Server provides a bunch of useful features to create, send, and manage emails. One of these features is a shared mailbox that can be accessed by multiple users. While working with MS Exchange Server from within your .NET applications, you may need to access emails from a shared mailbox. So in this article, you will learn how to read email messages from a shared mailbox on MS Exchange Server using C# .NET.
C# .NET API to Read Emails from Shared Mailbox on Exchange Server
Aspose.Email for .NET is an email processing API that provides a range of features to create, send, and process emails. In addition, it allows you to work with MS Outlook and Exchange Server without writing complex code. We will use this API to read emails from the shared mailboxes on MS Exchange Server. You can either download the API’s DLL or install it from NuGet using the following command.
PM> Install-Package Aspose.Email
Read Emails from a Shared Mailbox on Exchange Server in C#
The following are the steps to read emails from a shared mailbox on MS Exchange Server with an EWS client in C#.
- Specify the network credentials.
- Connect to Exchange Server and get the instance of the EWS client into an IEWSClient object.
- Get emails into an array from the desired folder using IEWSClient.ListItems(String, String) method.
- Loop through each email in the array and perform the following steps:
The following code sample shows how to read email messages from a shared mailbox on MS Exchange Server in C#.
Get a Free API License
You can get a free temporary license to use Aspose.Email for .NET without evaluation limitations.
In this article, you have learned how to read email messages from a shared mailbox on Microsoft Exchange Server in C#. To integrate this feature into your .NET applications, you can simply install the API and use the provided code sample. In addition, you can read about other features of Aspose.Email for .NET from the documentation. Also, you can ask your questions via our forum.