Exchange Web Services (EWS) in Exchange Online started being switched off in October 2026. It goes tenant by tenant: after a 7-day warning in the Message Center, Microsoft blocks EWS in tenants still on the default setting, and apps that use it stop working. An admin can switch it back on for listed apps, but only until April 1, 2027. From that day EWS is fully and permanently disabled for every tenant, and Microsoft says there will be no exceptions. Here is how to find what still uses EWS and move it to Microsoft Graph.
Checked against Microsoft's documentation on November 19, 2026.
Get-OrganizationConfig -RetrieveEwsOperationAccessPolicy | Fl EwsAllowedAppIDs shows the app IDs allowed to use EWS. If Microsoft switched EWS off in your tenant, it first filled this list from the previous 60 days of EWS usage.grep -rIl --include='*.cs' --include='*.vb' --include='*.csproj' --include='*.vbproj' \
--include='*.ps1' --include='*.psm1' --include='*.py' --include='*.config' --include='*.json' \
-e 'Microsoft.Exchange.WebServices' -e 'Exchange.asmx' -e 'ExchangeService(' -e 'exchangelib' .
For C# code, Microsoft's EWS Analyzer (a code analyzer for Visual Studio and VS Code) lists the EWS operations it calls. That list is your migration backlog.
Microsoft first posts a warning in the Message Center 7 days ahead, then a post along the lines of "EWS has been disabled in your tenant". Apps that use EWS may keep asking for a username and password, or report that the EWS protocol is not available. Code that calls EWS gets HTTP 403 Forbidden with an X-EWS-Policy-Reason header: EWS is disabled for this user or tenant means EWSEnabled is off for the organization or the mailbox; EWS is blocked by policy for this user or tenant means the app ID allow list or a user-agent policy blocks the app.
A tenant admin can switch EWS back on in Baseline security mode in the Microsoft 365 admin center, or in Exchange Online PowerShell:
Get-OrganizationConfig | Fl EWSEnabled
Set-OrganizationConfig -EWSEnabled $true
With EWSEnabled set to $true, only the app IDs in EwsAllowedAppIDs can use EWS, and an empty list blocks every app. Where Microsoft switched EWS off itself, it first filled that list from the previous 60 days of usage, so a job that runs rarely can be missing. Add a missing app in Baseline security mode (Exclude specific apps) or in PowerShell. The setting takes a comma-separated list and replaces the whole list, so include the IDs already on it:
Get-OrganizationConfig -RetrieveEwsOperationAccessPolicy | Fl EwsAllowedAppIDs
Set-OrganizationConfig -EwsAllowedAppIDs "<IDs already on the list>,<your app's client ID>"
An EWSEnabled change usually applies within an hour, sometimes up to four; a change to the allow list takes up to 24 hours. Microsoft also documents Set-OrganizationConfig -EWSEnabled $null, which ignores the allow list and lets every app use EWS again until the final shutdown. Either way it is a bridge, not a fix: on April 1, 2027 tenant admins lose these settings and EWS is fully disabled.
Most server-side EWS code signs in as a service account with impersonation, or with the EWS-only full_access_as_app permission. With Graph you register an app in Microsoft Entra ID instead:
Mail.Read or Mail.ReadWrite, Mail.Send, Calendars.ReadWrite, Contacts.ReadWrite;Application Mail.Read assigned with a management scope or an administrative unit.Don't also consent the same permission tenant-wide in Entra ID. A permission consented there covers every mailbox in the tenant, and Exchange adds the two grants together, so the scope stops limiting anything. Changes take 30 minutes to 2 hours to apply; Test-ServicePrincipalAuthorization shows the result right away.
Before, with the EWS Managed API:
var service = new ExchangeService(ExchangeVersion.Exchange2013_SP1)
{
Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx"),
Credentials = new OAuthCredentials(accessToken),
ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "orders@contoso.com")
};
var unread = new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false);
FindItemsResults<Item> items = service.FindItems(WellKnownFolderName.Inbox, unread, new ItemView(50));
After, with the Microsoft Graph SDK for .NET (packages Microsoft.Graph 5.x or 6.x and Azure.Identity), inside an async method:
using System;
using System.Collections.Generic;
using Azure.Identity;
using Microsoft.Graph;
using Microsoft.Graph.Models;
var credential = new ClientCertificateCredential(tenantId, clientId, certificate);
var graph = new GraphServiceClient(credential, new[] { "https://graph.microsoft.com/.default" });
var page = await graph.Users["orders@contoso.com"].MailFolders["inbox"].Messages.GetAsync(r =>
{
r.QueryParameters.Filter = "receivedDateTime ge 2026-11-01T00:00:00Z and isRead eq false";
r.QueryParameters.Orderby = new[] { "receivedDateTime desc" };
r.QueryParameters.Select = new[] { "id", "subject", "from", "receivedDateTime", "hasAttachments" };
r.QueryParameters.Top = 50;
});
var pages = PageIterator<Message, MessageCollectionResponse>.CreatePageIterator(graph, page, m =>
{
Console.WriteLine($"{m.ReceivedDateTime} {m.Subject}");
return true; // keep paging
});
await pages.IterateAsync();
The mailbox you used to impersonate is now simply graph.Users["address"]. Graph pages its results, so a loop that relied on one big ItemView has to follow the next links, which PageIterator does for you.
| EWS Managed API | Microsoft Graph SDK (v5 and v6) |
|---|---|
FindItems(folder, filter, view) | Users[u].MailFolders["inbox"].Messages.GetAsync(...) with Filter, Select, Top |
EmailMessage.Bind(service, id) | Users[u].Messages[id].GetAsync() |
message.SendAndSaveCopy() | Users[u].SendMail.PostAsync(body) with SaveToSentItems = true |
item.Move(folderId) | Users[u].Messages[id].Move.PostAsync(new MovePostRequestBody { DestinationId = "archive" }) (namespace Microsoft.Graph.Users.Item.Messages.Item.Move) |
message.IsRead = true; message.Update(...) | Users[u].Messages[id].PatchAsync(new Message { IsRead = true }) |
FileAttachment.Load() | Users[u].Messages[id].Attachments.GetAsync(), then FileAttachment.ContentBytes |
Load ItemSchema.MimeContent | Users[u].Messages[id].Content.GetAsync() returns the MIME stream |
SyncFolderItems, pull notifications | Users[u].MailFolders["inbox"].Messages.Delta.GetAsDeltaGetResponseAsync() |
StreamingSubscription, push notifications | Subscriptions.PostAsync(new Subscription { ... }) plus a webhook |
FindAppointments with CalendarView | Users[u].CalendarView.GetAsync(...) with StartDateTime and EndDateTime |
GetUserAvailability | Users[u].Calendar.GetSchedule.PostAsGetSchedulePostResponseAsync(...) |
GetUserOofSettings / SetUserOofSettings | Users[u].MailboxSettings: read it, or update it with a PATCH |
ConvertId | Users[u].TranslateExchangeIds.PostAsTranslateExchangeIdsPostResponseAsync(...) |
Sending mail:
await graph.Users["orders@contoso.com"].SendMail.PostAsync(new Microsoft.Graph.Users.Item.SendMail.SendMailPostRequestBody
{
Message = new Message
{
Subject = "Your order has shipped",
Body = new ItemBody { ContentType = BodyType.Html, Content = html },
ToRecipients = new List<Recipient> { new Recipient { EmailAddress = new EmailAddress { Address = "customer@example.com" } } }
},
SaveToSentItems = true
});
validationToken within 10 seconds. Mail subscriptions expire after at most 10,080 minutes (just under 7 days), or 1,440 minutes when they include resource data, so renew them on a timer and check clientState on every call.SyncFolderItems become delta queries. Page through the results, store the final delta link, and start the next sync from it:var next = new Microsoft.Graph.Users.Item.MailFolders.Item.Messages.Delta.DeltaRequestBuilder(storedDeltaLink, graph.RequestAdapter);
var changes = await next.GetAsDeltaGetResponseAsync();
// process changes.Value, follow changes.OdataNextLink, then store changes.OdataDeltaLink
translateExchangeIds (up to 1,000 per call, one mailbox at a time). Request immutable IDs with the header Prefer: IdType="ImmutableId", so an ID survives a move to another folder.$orderby must also appear in $filter, first and in the same order. Otherwise Graph rejects the request as too complex. That is why the example above filters on receivedDateTime.createUploadSession).Retry-After on HTTP 429 only for requests sent on their own: a batch returns 200 even when requests inside it were throttled, so check every response in the batch and resend the 429s after their Retry-After. Keep each mailbox to 4 requests in flight: one unordered batch already uses all 4.ExtendedPropertyDefinition are available as singleValueExtendedProperties with $expand, in Graph's own ID format.$search with KQL, such as "subject:invoice".Prefer: outlook.timezone="..." and Prefer: outlook.body-content-type="text" if your code expects them.await needs an async method around it. Keep using System.Collections.Generic;: without it, List<Recipient> resolves to Graph's own non-generic List type and fails with CS0308.Microsoft has confirmed three EWS capabilities that won't be added to Microsoft Graph:
Microsoft's roadmap targets other gaps for late 2026, such as full-fidelity import and export for archive mailboxes, public folders and group mailboxes, access to in-place archives, and creating non-draft messages from MIME. Capabilities missing from that roadmap shouldn't be expected before EWS is fully disabled. If your app reads or writes items in one of the three places above, plan a redesign, for example a shared mailbox or SharePoint instead of a public folder; backup and migration tools may get by with the import and export APIs once they ship.
Scripts that load Microsoft.Exchange.WebServices.dll move to the Microsoft Graph PowerShell SDK:
Connect-MgGraph -ClientId $appId -TenantId $tenantId -CertificateThumbprint $thumbprint
Get-MgUserMailFolderMessage -UserId orders@contoso.com -MailFolderId inbox `
-Filter "isRead eq false" -Top 50 -Property id,subject,receivedDateTime
Move-MgUserMessage -UserId orders@contoso.com -MessageId $id -DestinationId archive
exchangelib talks to Exchange Web Services, so scripts built on it stop reaching Exchange Online mailboxes when EWS is switched off there. Port them to the Microsoft Graph SDK for Python (msgraph-sdk) with a certificate credential from azure-identity:
import asyncio
from azure.identity.aio import CertificateCredential
from msgraph import GraphServiceClient
async def main():
credential = CertificateCredential(tenant_id, client_id, "app-cert.pem")
graph = GraphServiceClient(credential, scopes=["https://graph.microsoft.com/.default"])
page = await graph.users.by_user_id("orders@contoso.com").mail_folders.by_mail_folder_id("inbox").messages.get()
for m in page.value:
print(m.received_date_time, m.subject)
asyncio.run(main())