MSGraphEmailReader 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package MSGraphEmailReader --version 1.0.1                
NuGet\Install-Package MSGraphEmailReader -Version 1.0.1                
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.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MSGraphEmailReader --version 1.0.1                
#r "nuget: MSGraphEmailReader, 1.0.1"                
#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.1

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

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 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. 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:

  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.

  5. Find the SharedMailBoxFolderId using this code await graphServiceClient.Users[graphEmailRequest.UserMailAddress].MailFolders.Request().GetAsync()

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

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 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 308 10/15/2023
1.0.2 127 9/25/2023
1.0.1 137 9/19/2023
1.0.0 125 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.