Bsa.Exchange.WebServices
10.0.1
dotnet add package Bsa.Exchange.WebServices --version 10.0.1
NuGet\Install-Package Bsa.Exchange.WebServices -Version 10.0.1
<PackageReference Include="Bsa.Exchange.WebServices" Version="10.0.1" />
<PackageVersion Include="Bsa.Exchange.WebServices" Version="10.0.1" />
<PackageReference Include="Bsa.Exchange.WebServices" />
paket add Bsa.Exchange.WebServices --version 10.0.1
#r "nuget: Bsa.Exchange.WebServices, 10.0.1"
#:package Bsa.Exchange.WebServices@10.0.1
#addin nuget:?package=Bsa.Exchange.WebServices&version=10.0.1
#tool nuget:?package=Bsa.Exchange.WebServices&version=10.0.1
Bsa.Exchange.WebServices
Exchange Web Services (EWS) Managed API 2.2, ported to .NET 6.
This is a drop-in replacement for the legacy Microsoft.Exchange.WebServices 2.2.0 NuGet package (2018, .NET Framework only). It is built from Microsoft's open-source code (OfficeDev/ews-managed-api, MIT). The public API is unchanged:
- same namespace:
Microsoft.Exchange.WebServices.Data - same assembly name:
Microsoft.Exchange.WebServices.dll - same synchronous API (
ExchangeService,Folder.Bind,FindItems,StreamingSubscription, …)
Code written for the original package should compile and run without changes.
Installation
dotnet add package Bsa.Exchange.WebServices
Target framework: net6.0. The package also works in .NET 7, 8, 9 and later projects.
If your project references Microsoft.Exchange.WebServices or Microsoft.Exchange.WebServices.NETStandard, remove that reference first. Both packages contain the same namespace.
Quick start
using System;
using Microsoft.Exchange.WebServices.Data;
var service = new ExchangeService(ExchangeVersion.Exchange2013_SP1)
{
Credentials = new WebCredentials("user@contoso.com", "password"),
Url = new Uri("https://mail.contoso.com/EWS/Exchange.asmx")
};
// or OAuth:
// service.Credentials = new OAuthCredentials(accessToken);
// or Autodiscover:
// service.AutodiscoverUrl("user@contoso.com", url => url.StartsWith("https://"));
Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
Console.WriteLine($"Inbox: {inbox.TotalCount} total, {inbox.UnreadCount} unread");
foreach (Item item in service.FindItems(WellKnownFolderName.Inbox, new ItemView(10)))
{
Console.WriteLine($"{item.DateTimeReceived:yyyy-MM-dd HH:mm} {item.Subject}");
}
Changes from the original 2.2 code
| Area | Problem on .NET 6 | Fix |
|---|---|---|
Safe XML readers (Security/*, EwsXmlReader) |
ProhibitDtd was removed from .NET Core |
Uses DtdProcessing.Prohibit |
HangingServiceRequestBase |
System.Web.HttpException is not available |
Catch removed. On .NET 6 these errors surface as IOException or WebException, which are already handled |
| Streaming subscriptions | The HttpClient-based response stream throws InvalidOperationException on ReadTimeout and crashed the process |
ReadTimeout is set only when Stream.CanTimeout is true |
GetUserPhotoResults.AsImage() |
System.Drawing is Windows-only |
Marked [SupportedOSPlatform("windows")]. On other platforms, use the Photo byte array |
| Autodiscover via LDAP SCP | System.DirectoryServices is Windows-only |
Skipped on Linux and macOS |
| Autodiscover via DNS SRV | P/Invoke into dnsapi.dll |
Skipped on Linux and macOS. Other Autodiscover methods still work |
X509CertificateCredentials |
X509Certificate2.PrivateKey is unreliable on .NET Core |
Uses GetRSAPrivateKey() |
BasicAuthModuleForUTF8 |
AuthenticationManager.Register does nothing on .NET Core |
Now a no-op. .NET already encodes Basic credentials as UTF-8 |
| MIME charsets | Legacy code pages (windows-1251, koi8-r, …) are not registered by default |
CodePagesEncodingProvider is registered when the assembly loads |
| Assembly metadata | InternalsVisibleTo pointed to internal Microsoft assemblies |
Removed |
The library does not use WCF or System.ServiceModel. SOAP requests are built directly with HttpWebRequest and XmlWriter, as in the original.
Platform notes
- Windows: full functionality.
- Linux / macOS: everything except LDAP and DNS SRV Autodiscover and
AsImage(). Use an explicitUrl, or Autodiscover by e-mail address over HTTPS.
Known limitations
- Exchange Online / Microsoft 365: Microsoft is retiring EWS. Phased disablement began on 1 October 2026, and EWS will be shut down permanently on 1 April 2027. Use Microsoft Graph for new Microsoft 365 integrations. Exchange Server on-premises is not affected, and EWS keeps working there.
HttpWebRequestis still used internally. It is marked obsolete (SYSLIB0014) but is fully functional on .NET 6 and later, because it runs onHttpClient.- The assembly is not strong-name signed with Microsoft's key. Rebuild any code that depended on the original strong name.
- No new async API was added. The API is the original synchronous one plus the classic
Begin*/End*methods.
License
MIT. Original code © Microsoft Corporation. See LICENSE.txt in the package.
Source code: https://github.com/S-DyX/Bsa.Exchange.WebServices
| Product | Versions 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. |
-
net10.0
- System.DirectoryServices (>= 10.0.13)
- System.Drawing.Common (>= 10.0.13)
- System.Security.Cryptography.Xml (>= 10.0.13)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.