MSGraphEmailReader 1.0.0
See the version list below for details.
dotnet add package MSGraphEmailReader --version 1.0.0
NuGet\Install-Package MSGraphEmailReader -Version 1.0.0
<PackageReference Include="MSGraphEmailReader" Version="1.0.0" />
paket add MSGraphEmailReader --version 1.0.0
#r "nuget: MSGraphEmailReader, 1.0.0"
// Install MSGraphEmailReader as a Cake Addin #addin nuget:?package=MSGraphEmailReader&version=1.0.0 // Install MSGraphEmailReader as a Cake Tool #tool nuget:?package=MSGraphEmailReader&version=1.0.0
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 requested date and time.
- Retrieve email attachments.
- Simple and easy-to-use API for integrating with Microsoft Graph.
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. The permissions types like Application & Delegates.
- Mail.Read, Mail.Read.Shared,User.Read
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.
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.Find the
SharedMailBoxFolderId
using this codeawait graphServiceClient.Users[graphEmailRequest.UserMailAddress].MailFolders.Request().GetAsync()
// 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.