Skip to main content

Safe Links, Safe Attachments and Teams protection

Microsoft documentedDefender for Office 365 · Source checked 2026-10-22 · Not yet verified in tenant · Sources: [1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17]

What it is​

Safe Links and Safe Attachments act after EOP has already passed a message. Safe Links wraps or checks URLs so the verdict is taken when the user clicks, not when the mail arrived. Safe Attachments opens the attachment in a sandbox (detonation) before it reaches the mailbox. Both exist because a link or file that was clean at delivery can be weaponised an hour later.

Both are policy driven with no default policy. The Built-in protection preset covers every recipient not in Standard, Strict or a custom policy. Two switches sit outside policies: Safe Attachments for SharePoint, OneDrive and Teams, and Safe Documents. Those are tenant-wide, set in the Global settings flyout on the Safe Attachments page.

Teams protection is the third surface. Safe Links in Teams checks links at click time without rewriting. Safe Attachments for Teams covers files. ZAP for Teams pulls back malware and high-confidence phishing after delivery, controlled by a Teams protection policy that is separate from presets and custom policies.

See the overview for where this sits, anti-phishing and presets for presets, and investigation and quarantine for quarantine and Explorer.

Licensing and prerequisites​

  • Everything here except Safe Documents needs Defender for Office 365 Plan 1 or Plan 2. Plan 1 is the cheapest SKU and ships inside Microsoft 365 Business Premium.
  • Plan 2 adds Advanced Hunting on Teams messages (MessageEvents, MessagePostDeliveryEvents, MessageURLInfo) and the Remove user from chat action.
  • Safe Documents needs the SAFEDOCS service plan from Microsoft 365 A5, E5, G5 or the Microsoft Defender Suite, plus Microsoft 365 Apps for enterprise version 2004 or later.
  • Built-in protection applies as soon as the tenant has one Defender for Office 365 licence.
  • Roles: Organization Management or Security Administrator in Email and collaboration RBAC, or Core Security settings (manage) in unified RBAC. SharePoint Administrator for the Set-SPOTenant download block.
  • ZAP for Teams is not available in GCC, GCC High or DoD. Dynamic Delivery works only for Exchange Online mailboxes.
  • Safe Links in Office apps needs Microsoft 365 Apps or Business Premium, modern auth and a work or school sign-in. Covered: Word, Excel, PowerPoint on all platforms, Visio on Windows, OneNote on the web, Outlook for Windows opening saved EML or MSG files.

How it works​

Mail flow first. For a recipient covered by a policy with email protection on, URLs are rewritten to https://<region>.safelinks.protection.outlook.com/.... Hovering in Outlook shows the original. With Apply real-time URL scanning on, suspicious links and links to files are detonated during mail flow, and with Wait for URL scanning on, the message is held until that finishes.

Click time second. The wrapped URL goes to the Safe Links service for a reputation check. Known malicious gives the warning page. A link to a downloadable file gets the file checked if real-time scanning is on. Clean opens the destination. The outcome lands in UrlClickEvents when Track user clicks is on.

Rewriting is optional. Do not rewrite URLs, do checks via SafeLinks API only leaves the original URL in the body and relies on the client calling the Safe Links API at click. That works in Outlook on Windows, Mac, iOS, Android and the web. Any other client gets no click-time check. Native rendering looks nicer; rewriting protects every client. Built-in protection has API-only on; Standard and Strict rewrite.

Internal mail is a separate toggle, off in Built-in protection and on in Standard, Strict and new custom policies. Without it a compromised internal mailbox is a clean delivery path.

Teams and Office apps never rewrite. The client asks Safe Links at click and shows the warning if needed. In a Teams chat the warning opens in the browser; in a pinned tab it opens inside Teams with open-in-browser disabled. Teams changes take up to 24 hours.

Click-through is the user bypass: a continue option on the warning page, recorded as IsClickedThrough. Built-in protection allows it. Standard and Strict do not.

Safe Attachments​

An attachment that passed EOP anti-malware is opened in a virtual machine in the tenant's data region. Learn says this usually completes within 15 minutes but can take longer. The policy action decides what happens to the message meanwhile:

ActionBehaviourWhere Learn puts it
OffNo detonation. Anti-malware only. ZAP will not quarantine if no threat signal arrives.Trusted-sender-only recipients, not recommended
MonitorDeliver, then record detections. Delivery can still be delayed. Redirect to an address is available only here.Visibility
BlockHold until verdict. Malicious goes to quarantine under the policy's quarantine tag. Future copies of the same message and file are blocked automatically.Default, Standard, Strict
Dynamic DeliveryDeliver the body now with a placeholder attachment. Swap in the real file when clean, quarantine when malicious. PDFs and Office files can be previewed in safe mode while waiting.Avoid latency on Exchange Online mailboxes

Block adds a second decision for password-protected files. Block messages containing encrypted attachments that could not be scanned quarantines messages where detonation could not open the file, reason Password protected item. A user with a full-access quarantine policy can enter the attachment password once, Safe Attachments runs a just-in-time detonation, and the message is released if clean. PDF, archive, Office or all other types can be excluded.

Safe Attachments for SharePoint, OneDrive and Teams​

One tenant switch, EnableATPForSPOTeamsODB. It runs after the built-in virus engine and detonates files asynchronously. Learn is explicit that not every file is scanned; sharing events, guest activity, heuristics and threat signals decide. A malicious file is locked in place: still visible, cannot be opened, copied, moved or shared, but by default can still be downloaded and deleted. Set-SPOTenant -DisallowInfectedFileDownload $true removes the download. Detections appear under Content, Malware in the Threat protection status report and Explorer.

Safe Documents is the client-side relative. When Office opens a file in Protected View, file information goes to the Defender for Endpoint cloud for a verdict before the user can leave Protected View. No MDE sensor is needed, except for auditing. The second toggle decides whether users can leave Protected View on a malicious verdict.

Teams protection​

All Teams licences get near real-time URL warnings on known malicious links, including messages found bad up to 48 hours later. Plan 1 adds Safe Links in Teams, Safe Attachments for Teams files, Tenant Allow/Block List enforcement in Teams, ZAP for Teams, Teams message quarantine and the Teams message entity panel. ZAP for Teams acts on malware and high-confidence phishing only, in internal chats, internal standard channels, and all messages in shared channels. Private channels are out. Everyone in a chat sees the same copy, so a ZAP block hits all participants. Exclusions are evaluated against recipients, and ZAP still acts if any one recipient is not excluded.

Global versus policy​

SettingLives inCmdlet
URL rewriting, internal mail, real-time scan, click tracking, click-through, do-not-rewrite list, Teams and Office app checksSafe Links policy*-SafeLinksPolicy
Action, quarantine tag, redirect, encrypted attachment blockingSafe Attachments policy*-SafeAttachmentPolicy
SharePoint, OneDrive and Teams file protectionGlobal settingsSet-AtpPolicyForO365 -EnableATPForSPOTeamsODB
Safe Documents on, Protected View click-throughGlobal settingsSet-AtpPolicyForO365 -EnableSafeDocs -AllowSafeDocsOpen
ZAP for Teams, Teams quarantine policies, recipient exclusionsTeams protection policy*-TeamsProtectionPolicy, *-TeamsProtectionPolicyRule

Policy precedence: Strict, Standard, custom by priority with 0 highest, Built-in protection last. Processing stops at the first match. Global settings and the Teams protection policy sit outside this order.

Configure​

Safe Links policy, Email and collaboration > Policies and rules > Threat policies > Safe Links, or https://security.microsoft.com/safelinksv2:

  1. Create. Name it. Users and domains: users, groups or accepted domains. Condition types are ANDed, exclusions ORed. Dynamic groups are not supported.
  2. URL and click protection settings, recommended values matching Standard and Strict:
    • Email: On. Leave Do not rewrite URLs, do checks via SafeLinks API only clear unless every client is Outlook.
    • Apply Safe Links to email messages sent within the organization: on.
    • Apply real-time URL scanning for suspicious links and links that point to files: on. Wait for URL scanning to complete before delivering the message: on.
    • Do not rewrite the following URLs in email: empty. See gotchas.
    • Teams: On. Office 365 apps: On.
    • Track user clicks: on. Let users click through to the original URL: off. Organization branding: optional, needs a logo first.
  3. Notification: default text, or custom up to 200 characters.
  4. Review, Submit. Allow up to 6 hours, 24 for Teams.
Safe Links policy list with a custom policy selected. Preset policies appear here but are edited on the Preset security policies page. Source: Microsoft Learn, CC BY 4.0.
Safe Links policy list with a custom policy selected. Preset policies appear here but are edited on the Preset security policies page. Source: Microsoft Learn, CC BY 4.0. · captured 2026-10-22
The malicious website warning page a user sees at click time. With click-through off there is no continue option. Source: Microsoft Learn, CC BY 4.0.
The malicious website warning page a user sees at click time. With click-through off there is no continue option. Source: Microsoft Learn, CC BY 4.0. · captured 2026-10-22
The same verdict delivered from a Teams click. No rewriting happened; the client asked Safe Links at click. Source: Microsoft Learn, CC BY 4.0.
The same verdict delivered from a Teams click. No rewriting happened; the client asked Safe Links at click. Source: Microsoft Learn, CC BY 4.0. · captured 2026-10-22

Safe Attachments policy, Threat policies > Safe Attachments, or https://security.microsoft.com/safeattachmentv2:

  1. Create. Name, then recipients as above.
  2. Settings:
    • Safe Attachments unknown malware response: Block. Dynamic Delivery where latency complaints outweigh the placeholder experience.
    • Quarantine policy: AdminOnlyAccessPolicy, the default and what presets use. Users can request release only.
    • Redirect messages with detected attachments: Monitor only.
    • Block messages containing encrypted attachments that could not be scanned: shown only with Block. Pick exclusions and the quarantine policy, default DefaultFullAccessWithNotificationPolicy so users can supply the password.
  3. Review, Submit. Allow about 30 minutes.
Safe Attachments policy list. Status, priority and More actions for bulk enable, disable and delete. Source: Microsoft Learn, CC BY 4.0.
Safe Attachments policy list. Status, priority and More actions for bulk enable, disable and delete. Source: Microsoft Learn, CC BY 4.0. · captured 2026-10-22

Global settings, gear icon on the Safe Attachments page:

  1. Protect files in SharePoint, OneDrive, and Microsoft Teams: toggle Turn on Defender for Office 365 for SharePoint, OneDrive, and Microsoft Teams to On. Built-in protection already sets this on.
  2. Turn on Safe Documents for Office clients: On if licensed. Allow people to click through Protected View even if Safe Documents identified the file as malicious: Off.
  3. Save. Allow 30 minutes.
Global settings flyout with the Safe Documents toggles. Tenant-wide, not per policy. Source: Microsoft Learn, CC BY 4.0.
Global settings flyout with the Safe Documents toggles. Tenant-wide, not per policy. Source: Microsoft Learn, CC BY 4.0. · captured 2026-10-22
What a user sees in OneDrive when Safe Attachments for SharePoint, OneDrive and Teams locks a file. Open, copy, move and share are gone; download stays unless blocked in SharePoint PowerShell. Source: Microsoft Learn, CC BY 4.0.
What a user sees in OneDrive when Safe Attachments for SharePoint, OneDrive and Teams locks a file. Open, copy, move and share are gone; download stays unless blocked in SharePoint PowerShell. Source: Microsoft Learn, CC BY 4.0. · captured 2026-10-22

Teams protection, Settings > Email and collaboration > Microsoft Teams protection, or https://security.microsoft.com/securitysettings/teamsProtectionPolicy:

  1. Zero-hour auto purge (ZAP): On.
  2. Quarantine policies for Malware and High confidence phishing. Teams quarantine is admin-only today, so AdminOnlyAccessPolicy applies and users get no notification.
  3. Exclude these participants: users, groups or domains. These are recipient exclusions. For a channel use the recipient address from the Teams message entity panel, not the channel email address.
  4. Save.
Microsoft Teams protection page with the ZAP toggle, quarantine policy pickers and participant exclusions. Source: Microsoft Learn, CC BY 4.0.
Microsoft Teams protection page with the ZAP toggle, quarantine policy pickers and participant exclusions. Source: Microsoft Learn, CC BY 4.0. · captured 2026-10-22

Learn also recommends an alert policy on Detected malware in file so SharePoint and OneDrive detections email someone.

Verify​

  • Safe Links: send yourself http://spamlink.contoso.com. Learn documents it as a harmless URL that triggers a Safe Links response, like GTUBE. Hover in Outlook for the safelinks.protection.outlook.com wrapper, click for the warning page.
  • Safe Documents: Learn lists SafeDocsDemo.docx, SafeDocsDemo.pptx and SafeDocsDemo.xlsx as harmless trigger files. Open one from an untrusted location so Protected View engages.
  • Safe Attachments email: Learn documents no EICAR equivalent for detonation. TODO: test with a benign macro document in the dev tenant. Detections show in Explorer as detection technology File detonation or File detonation reputation; Dynamic Delivery shows as Delivery action Replaced plus Additional action Dynamic Delivery.
  • URL protection report at https://security.microsoft.com/URLProtectionActionReport, by click protection action or by application (Email client, Teams, Office document). No data means Track user clicks is off.
  • Teams: Explorer has a URL clicks view including Teams clicks and a Content malware view for SharePoint, OneDrive and Teams files. Teams quarantine is the Teams message tab in Quarantine. ZAP for email shows as Additional action = ZAP and is not in mailbox audit.
URL protection report, click protection action view. Allowed is filtered out by default, so the chart shows blocks and click-throughs first. Source: Microsoft Learn, CC BY 4.0.
URL protection report, click protection action view. Allowed is filtered out by default, so the chart shows blocks and click-throughs first. Source: Microsoft Learn, CC BY 4.0. · captured 2026-10-22
// Who clicked through a Safe Links block in the last 30 days, with the mail it came from
UrlClickEvents
| where IsClickedThrough == true
| join kind=leftouter (EmailEvents | project NetworkMessageId, Subject, SenderFromAddress) on NetworkMessageId
| project Timestamp, AccountUpn, Workload, AppName, Url, ThreatTypes, Subject, SenderFromAddress
| order by Timestamp desc
Get-SafeLinksPolicy | Format-Table Name, EnableSafeLinksForEmail, EnableForInternalSenders, DisableUrlRewrite, AllowClickThrough
Get-SafeAttachmentPolicy | Format-Table Name, Enable, Action, QuarantineTag, EnableBlockingEncryptedAttachments
Get-AtpPolicyForO365 | Format-List EnableATPForSPOTeamsODB, EnableSafeDocs, AllowSafeDocsOpen
Get-TeamsProtectionPolicy | Format-List Name, ZapEnabled, HighConfidencePhishQuarantineTag, MalwareQuarantineTag
Get-SPOTenant | Format-List DisallowInfectedFileDownload

Troubleshoot​

SymptomLikely causeFix
Links not rewritten in emailRecipient is in a policy with API-only mode, or Built-in protection applies (it has API-only on), or a third-party gateway wrapped the links first, or the message is RTF, S/MIME signed or in a mail-enabled public folderCheck which policy wins with Get-SafeLinksRule, clear DisableUrlRewrite, route mail so Defender for Office 365 sees it before any other wrapper
Links rewritten but no click dataTrack user clicks off in the effective policySet -TrackClicks $true; the URL protection report and UrlClickEvents depend on it
SharePoint and OneDrive URLs are no longer wrappedBy design. Learn says these are processed without wrapping to improve load timeNothing to fix
Users can continue past the warning pageBuilt-in protection allows click-throughPut users in Standard or Strict, or set -AllowClickThrough $false in the custom policy
Users complain of delays, attachment shows as a placeholderDynamic Delivery is working as designed, detonation can take 15 minutes or moreSwitch to Block if the preview is confusing, or accept it. Placeholders are never replaced in public folders, archived messages, messages moved by inbox rules, S/MIME messages or on-prem mailboxes
Attachment never arrives, message in quarantine as Password protected itemBlock unscanned attachments is on and the file is password protectedUser releases with the password once from the quarantine notification, or admin releases. Exclude types if this is routine
File in SharePoint or OneDrive is locked, user cannot open itSafe Attachments for SharePoint, OneDrive and Teams detonated it and found it maliciousReview in quarantine and the Content malware view. If a false positive, submit the file to Microsoft. Users can delete it
Users can still download a locked SharePoint fileDisallowInfectedFileDownload is false by defaultSet-SPOTenant -DisallowInfectedFileDownload $true, affects admins too
Teams links not checkedTeams toggle off in the policy covering the sender, or the policy changed less than 24 hours agoTurn on Teams protection in the policy. Learn says the sender needs to be covered too, otherwise the recipient can click through to the original
Teams warning page forces re-login on the destination siteSite needs SameSite=Strict cookies and the Safe Links redirect is cross-siteKnown behaviour, no fix in the policy
ZAP for Teams did nothing on an external chatZAP covers internal chats and standard channels only, plus shared channelsExpected. Tenant Allow/Block List block entries and user reporting still apply
Safe Documents does nothingNo SAFEDOCS service plan, Office older than 2004, or global toggle offCheck licence, Get-AtpPolicyForO365, and the Office build
Policy save returns 403 or CmdletAccessDeniedExceptionExchange Online RBAC cacheOpen a support case and ask for an RBAC configuration refresh

Gotchas and limits​

  • The Do not rewrite list only affects mail flow. Those URLs are not scanned or wrapped at delivery but can still be blocked at click, and Teams and Office web apps ignore the list. Each policy has its own list and only the first matching policy applies. Learn's direction: use it for internal on-prem URLs, and allow anything else by reporting the URL as clean and choosing Allow this URL, which adds a Tenant Allow/Block List entry covering mail flow and click time.
  • The reverse holds too. A plain URL allow entry in the Tenant Allow/Block List does not stop Safe Links rewriting it. Only the Report as clean plus Allow this URL path does.
  • API-only mode is a client bet. Only Outlook on Windows, Mac, iOS, Android and the web call the Safe Links API. Anything else, including automatic forwards to unprotected recipients, gets no click check.
  • Built-in protection is weaker than it looks: API-only on, click-through allowed, internal mail skipped. Standard and Strict fix all three. A custom policy must too.
  • Safe Links handles HTTP, HTTPS and FTP only. RTF (TNEF) bodies and S/MIME signed mail are not processed.
  • Archives: files are identified by true type, not extension. Learn only documents archive handling for the password-protected case: zip, gzip, 7z, rar and tar can be excluded from Block unscanned attachments, and an archive with items under different passwords is not supported for self-release. TODO: Learn gives no nesting depth or size limits for detonation. Test in the dev tenant.
  • Block creates a reputation entry: future copies of a quarantined message plus attachment are blocked automatically.
  • Safe Documents is an E5 or Defender Suite service plan, not a Defender for Office 365 feature. The toggle exists in every tenant and does nothing without SAFEDOCS.
  • Safe Attachments for SharePoint, OneDrive and Teams does not scan every file and Learn gives no timing. Do not sell it as full library scanning.
  • Monitor and Redirect: MC918563 announced their retirement between February and May 2025, with Monitor policies switching to Block. Learn pages checked on 2026-10-22 still list both. TODO: check what the dev tenant portal offers.
  • Encrypted attachment blocking rolled out worldwide in August 2026 per MC1440701; GCC High and DoD through late October 2026.
  • ZAP for Teams quarantine is admin-only with no user notification.
  • A policy created in PowerShell is invisible in the portal until a rule references it. Renaming in the portal renames the rule, not the policy.

Further reading​

Only three qualified in the October 2025 to October 2026 window. The Copilot Chat Safe Links coverage write-ups are from May 2025.

My notes​

TODO: Sohail's notes after verification.

Changelog​

DateChangeSource
2026-10-22Drafted from Learn, with Learn images and diagrams[1]