TailoredApps.Shared.Email.Office365 2.1.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package TailoredApps.Shared.Email.Office365 --version 2.1.0
                    
NuGet\Install-Package TailoredApps.Shared.Email.Office365 -Version 2.1.0
                    
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="TailoredApps.Shared.Email.Office365" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TailoredApps.Shared.Email.Office365" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TailoredApps.Shared.Email.Office365" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TailoredApps.Shared.Email.Office365 --version 2.1.0
                    
#r "nuget: TailoredApps.Shared.Email.Office365, 2.1.0"
                    
#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.
#:package TailoredApps.Shared.Email.Office365@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TailoredApps.Shared.Email.Office365&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TailoredApps.Shared.Email.Office365&version=2.1.0
                    
Install as a Cake Tool

TailoredApps.Shared.Email.Office365

An IEmailProvider that reads messages from a Microsoft 365 mailbox over IMAP. It signs in as an application (OAuth2 client credentials, with a client secret or a certificate), so no user password is stored. The provider reads mail only; it does not send.

Installation

dotnet add package TailoredApps.Shared.Email.Office365

Registration

using TailoredApps.Shared.Email.Office365;

builder.Services.RegisterOffice365Provider();   // IEmailProvider -> Office365EmailProvider (transient)

Usage

using TailoredApps.Shared.Email;
using TailoredApps.Shared.Email.Models;

public class OrderMailReader(IEmailProvider mailbox)
{
    // Messages in Inbox/Orders from the last 24 hours whose sender contains the given text
    public Task<ICollection<MailMessage>> ReadLastDay()
        => mailbox.GetMail(folder: "Orders", sender: "orders@partner.example", fromLast: TimeSpan.FromHours(24));
}

Configuration

The Mail:Providers:Office365 section, bound to AuthenticationConfig:

{
  "Mail": {
    "Providers": {
      "Office365": {
        "Tenant": "<tenant-id-or-domain>",
        "ClientId": "<application-client-id>",
        "ClientSecret": "<client-secret>",
        "MailBox": "orders@example.com"
      }
    }
  }
}
Key Meaning Default
Tenant Tenant id or a domain of the tenant none
ClientId Application (client) id of the app registration none
ClientSecret Client secret; used when it is set none
Certificate A CertificateDescription (Microsoft.Identity.Web); used when there is no client secret none
MailBox Address of the mailbox to read none
Instance Authority format; {0} is replaced with Tenant https://login.microsoftonline.com/{0}
ApiUrl Bound, but not used by the provider https://graph.microsoft.com/

Good to know

  • SendMail is not implemented and throws NotImplementedException. Send with the SMTP provider from TailoredApps.Shared.Email. Both providers register IEmailProvider, so when both are registered a single injected IEmailProvider is the one registered last.
  • The provider connects to outlook.office365.com:993 over TLS and requests a token for https://outlook.office365.com/.default; neither is configurable. The app registration must be allowed to open the mailbox over IMAP as an application.
  • folder names a sub-folder of the Inbox; empty means the Inbox itself. The folder is opened read-only. sender and recipent are "contains" filters, fromLast limits the search to messages delivered after now minus that time span. With no filters, every message in the folder is downloaded.
  • Each matching message is downloaded whole. Attachments are decoded and returned as Base64, keyed by file name; a repeated name gets a (2) suffix and a part without a name is called attachment-N.
  • A missing configuration section throws InvalidOperationException; with neither ClientSecret nor Certificate the provider cannot be created; a missing MailBox throws InvalidOperationException in GetMail.

Documentation

https://shared.tailoredapps.pl/en/Libraries/Email/Office365/

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
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
3.0.0-preview.2 50 11/12/2026
3.0.0-preview.1 67 11/12/2026
2.1.0 89 11/12/2026
2.0.1 87 11/12/2026
2.0.0 107 11/12/2026
1.6.0 86 11/12/2026
1.4.19 142 10/26/2026
1.4.18 152 10/23/2026
1.4.17 147 10/6/2026
1.4.16 116 9/28/2026
1.4.15 118 9/21/2026
1.4.14 141 8/20/2026
1.4.13 126 8/20/2026
1.4.12 135 8/20/2026
1.4.11 134 8/7/2026
1.4.10 155 7/8/2026
1.4.9 147 7/8/2026
1.4.8 147 7/6/2026
1.4.7 138 5/20/2026
1.4.6 135 5/20/2026
Loading failed