MSGraphEmailReader 1.0.4

dotnet add package MSGraphEmailReader --version 1.0.4
NuGet\Install-Package MSGraphEmailReader -Version 1.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MSGraphEmailReader" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MSGraphEmailReader --version 1.0.4
#r "nuget: MSGraphEmailReader, 1.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MSGraphEmailReader as a Cake Addin
#addin nuget:?package=MSGraphEmailReader&version=1.0.4

// Install MSGraphEmailReader as a Cake Tool
#tool nuget:?package=MSGraphEmailReader&version=1.0.4


MSGraphEmailReader is a .NET class library that provides functionality for reading emails from Microsoft Graph. It allows you to fetch emails, including their attachments, from a specified mailbox folder in Microsoft 365 using Microsoft Graph API.


  • Authenticate with Microsoft Graph using client credentials.
  • Retrieve emails based on various filters, such as received date and time.
  • Retrieve email attachments.
  • Simple and easy-to-use API for integrating with Microsoft Graph.
  • Also Retrieve Un-opened emails based on filter.


Before using MSGraphEmailReader, make sure you have the following prerequisites in place:

  • Client Application Registration: You need to register your application in the Azure Portal and obtain a ClientId and ClientSecret for authentication with Microsoft Graph.

  • Azure AD Tenant: You must have access to an Azure AD tenant where you can register your application.

  • Access to Microsoft 365: Ensure that your application has the necessary permissions to access Microsoft 365 mailbox data. The required permissions may vary depending on your use case.

  • User Mailbox and Shared Mailbox Information: You should have the email addresses and folder IDs for the user mailbox and the shared mailbox folder from which you want to read emails.

  • While Using ReadUnopenedEmailsAsync: Need to give some specific permissions Mail.ReadWrite or Mail.Send depending on your use case.

Getting Started

To get started with MSGraphEmailReader, follow these steps:

  1. Clone or download the repository.

  2. Configure your application settings by providing the necessary values in the appsettings.json file, including ClientId, ClientSecret, TenantId, UserMailAddress, and SharedMailBoxFolderId.

  3. Initialize the GraphEmailRequest object with your configuration.

  4. Use the ReadEmailAsync method to retrieve emails from Microsoft Graph based on the specific Dateframe.

  5. Use the ReadUnopenedEmailsAsync method to read all un-opened emails and their attachments without applying a date filter.

// Example usage
GraphEmailRequest graphEmailRequest = new GraphEmailRequest
    ClientId = "YourClientId",
    ClientSecret = "YourClientSecret",
    TenantId = "YourTenantId",
    UserMailAddress = "UserEmailAddress",
    SharedMailBoxFolderId = "SharedMailboxFolderId",

ReadEmails reader = new ReadEmails();
List<GraphMail> emails = await reader.ReadEmailAsync(graphEmailRequest);


Contributions to MSGraphEmailReader are welcome! Please feel free to submit pull requests or raise issues if you have any feedback, suggestions, or bug reports.


This project is inspired by the need to interact with Microsoft 365 mailbox data using the Microsoft Graph API. We would like to acknowledge the developers and contributors to the Microsoft Graph SDK for making this functionality accessible.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 258 10/15/2023
1.0.2 102 9/25/2023
1.0.1 107 9/19/2023
1.0.0 98 9/19/2023

MSGraphEmailReader is a .NET class library that provides functionality for reading emails from Microsoft Graph. It allows you to fetch emails, including their attachments, from a specified mailbox folder in Microsoft 365 using Microsoft Graph API.
Release 1.0.2 : In 1st release mail will be fetch from CurrentPage only. In 1.0.2 release Fetch Mails based on Pagination will read all e-mails from current page & next page also.
Release 1.0.4 : In this release mail will be fetch based on un-open in the mail box. The Un-Opened mails will be read and process.