ShareFlow
All articles

News

SharePoint one-time passcode retirement: what to do

SharePoint one-time passcode ends in November 2026. Find which external users lose access to old links, how to spot them and how to restore access fast.

Valentin Laurent6 min read
Share

The SharePoint one-time passcode (SharePoint OTP), which let an external person open a shared file with a code sent by email, is being retired (message MC1243549). Since mid-October 2026, external users who don't have a Microsoft Entra B2B guest account get "access denied" on their old "Specific people" links, and Microsoft expects to finish by the end of November 2026. The good news: one action per person is enough to restore access.

SharePoint one-time passcode: what goes, what stays

Until now, an external person without a Microsoft account could authenticate on shared content in two ways:

  • the SharePoint one-time passcode: SharePoint sent a code without creating anything in the directory. The person only existed in the sites where something was shared with them (an identity like urn:spo:guest#address);
  • the Entra B2B email one-time passcode: the same experience for the external person, but they become a guest account in Microsoft Entra ID, covered by Conditional Access, multifactor authentication and access reviews.

The first one is going away. The second one stays and becomes the normal path.

The change came in two steps. Between May and July 2026, Microsoft moved all new external sharing to Entra B2B, with no way back: the EnableAzureADB2BIntegration setting of Set-SPOTenant no longer controls anything in commercial tenants. Since mid-October, the old mechanism is being switched off for earlier shares.

Who loses access, and how to restore it

The rule is simple: an external person who opens an old "Specific people" link keeps access if your directory has a guest account with the same email address. Otherwise, they get access denied.

Decision diagram: an external person opens an old Specific people link. With an Entra B2B guest account using the same address, access is kept. Without one, access is denied, which is fixed by creating the guest account or resharing a single item with them
After the retirement, it all depends on whether a guest account exists

There are two ways to restore access, and neither requires resharing every file:

  1. an admin creates the guest account in Entra ID, using the address that received the original link;
  2. an internal user reshares one item (file, folder or site) with that person: the share now goes through Entra B2B, which creates the guest account, and all the old links work again.

Microsoft states that no duplicate is created if the guest account already exists.

What it changes in practice

For users

External people who work with you often have probably received a new share since May, so they already have a guest account: they won't notice anything. The ones who get stuck are the occasional partners: the auditor who comes back once a year, the contractor from an old project, the partner reopening a link from two years ago. They will hit access denied and email you. The answer fits in one sentence: "I'll reshare a document with you."

For admins

The real topic is in Entra ID, because SharePoint no longer decides alone. If your External collaboration settings limit invitations to admins, a user who reshares with an external person who has no guest account will see the share fail. Entra settings win over SharePoint settings when they are more restrictive.

Two settings to check in the Microsoft Entra admin center:

  • Who can invite: under External Identities > External collaboration settings. If only admins can invite, give the Guest Inviter role to the people who share externally, or set up a request process.
  • Email one-time passcode: under External Identities > All identity providers > Built-in tab. Keep it on, otherwise external people without a Microsoft account will be asked to create one. It is on by default unless someone turned it off.

If you enforce multifactor authentication for guests with Conditional Access, note that authentication strengths don't apply to accounts signing in with an email code: use the Require multifactor authentication grant control instead.

Finding the affected external users

Microsoft provides a site sharing report: Settings > Site usage > Shared with external users section > Run report. The CSV lists every user and link; the User E-mail column gives the addresses to compare with your guest accounts. Handy for a few sites, tedious for a whole tenant.

For a tenant-wide inventory, OTP users are easy to recognize: their login name contains urn:spo:guest. This PnP PowerShell script goes through the sites and lists them in a CSV. I ran it on my demo tenant: it changes nothing.

# PowerShell 7.4+ and PnP.PowerShell 3.x, with your own app registration
$clientId = "<your PnP app ID>"
$adminUrl = "https://contoso-admin.sharepoint.com"

Connect-PnPOnline -Url $adminUrl -ClientId $clientId -Interactive -PersistLogin
$sites = Get-PnPTenantSite | Where-Object Template -notlike "REDIRECT*"

$otpUsers = foreach ($site in $sites) {
    try {
        $connection = Connect-PnPOnline -Url $site.Url -ClientId $clientId -Interactive -PersistLogin -ReturnConnection
        Get-PnPUser -Connection $connection |
            Where-Object LoginName -like "*urn:spo:guest*" |
            Select-Object @{ n = "Site"; e = { $site.Url } }, Title, Email
    }
    catch {
        Write-Warning "$($site.Url): $($_.Exception.Message)"
    }
}

$otpUsers | Export-Csv ".\otp-external-users.csv" -NoTypeInformation -Encoding utf8

Two limits to keep in mind. With a delegated sign-in, the script only reads the sites your account can access: the others return "Access is denied" (which is what I got on two sites of the demo tenant). To cover the whole tenant, use an app-only connection with a certificate. And add -IncludeOneDriveSites to Get-PnPTenantSite if your users share a lot from OneDrive.

To see who still actually uses these links, a Microsoft Purview audit log search helps you separate active external users from those who haven't opened anything in months.

For the external users you want to keep, create the guest account without sending an invitation, with Microsoft Graph PowerShell (User.Invite.All permission):

Connect-MgGraph -Scopes "User.Invite.All"

Import-Csv ".\otp-external-users.csv" |
    Sort-Object Email -Unique |
    ForEach-Object {
        New-MgInvitation -InvitedUserEmailAddress $_.Email `
            -InviteRedirectUrl "https://contoso.sharepoint.com" `
            -SendInvitationMessage:$false -ErrorAction Stop
    }

Review the CSV first: it's the right time not to recreate access for a contractor whose engagement ended long ago.

What I recommend you do

  1. Check your Entra ID settings today: who can invite, and email one-time passcode turned on.
  2. Inventory OTP users with the sharing report or the script above, and decide who keeps access.
  3. Create guest accounts in advance for active external users, without an invitation, so they see no interruption.
  4. Warn the helpdesk and site owners: access denied on an old link is fixed by resharing a single item.
  5. Plan a guest account review: there will be more of them, and now is the time to set up expiration.

If access is already hard to track internally, start by choosing the right type of group to manage access. And if you want help sorting out external access, that's the kind of governance work I support in consulting.

Sources

Share this article

Know a colleague or client who deals with this? Send them the article in one click.

Read next

Comments

Loading comments…

Leave a comment

Comments are reviewed before they are published. Only your first name and last-name initial are shown.