MSGraphEmailReader 1.0.4
dotnet add package MSGraphEmailReader --version 1.0.4
NuGet\Install-Package MSGraphEmailReader -Version 1.0.4
<PackageReference Include="MSGraphEmailReader" Version="1.0.4" />
paket add MSGraphEmailReader --version 1.0.4
#r "nuget: MSGraphEmailReader, 1.0.4"
// 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
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.
Features
- 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.
Prerequisites
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
andClientSecret
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
orMail.Send
depending on your use case.
Getting Started
To get started with MSGraphEmailReader, follow these steps:
Clone or download the repository.
Configure your application settings by providing the necessary values in the appsettings.json file, including
ClientId
,ClientSecret
,TenantId
,UserMailAddress
, andSharedMailBoxFolderId
.Initialize the
GraphEmailRequest
object with your configuration.Use the
ReadEmailAsync
method to retrieve emails from Microsoft Graph based on the specific Dateframe.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);
Contributing
Contributions to MSGraphEmailReader are welcome! Please feel free to submit pull requests or raise issues if you have any feedback, suggestions, or bug reports.
Acknowledgments
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 | Versions 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. |
-
net6.0
- Microsoft.Graph (>= 4.48.0)
- Microsoft.IdentityModel.Clients.ActiveDirectory (>= 5.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
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.