Teams file links automatically add URL prefix

Has anyone encountered this error and found a solution?

This issue appears when opening a link from a file shared on Teams.


If you copy and paste the link on the desktop, it will work fine, but it won't work when opened directly from Teams.

Note: The first time you open a URL from a document, it works fine. However, if you try to open it again, a run-time error occurs, as shown in the attachment.

https://can01.safelinks.protection.outlook.com/GetUrlReputation

I’ve encountered this issue before, and it’s pretty frustrating. The problem you’re facing is due to Microsoft Teams’ built-in URL protection feature, which automatically adds a Safelinks prefix to the URL.

Here’s what’s happening:

  • When you open a link from a file shared on Teams, it gets redirected through Microsoft’s Safelinks service. This service checks the URL for potential malware or phishing threats.
  • The first time you open the link, it works fine because Safelinks has not marked the URL as malicious. However, subsequent attempts to open the same link result in the runtime error you’re seeing.

To bypass this issue, you can try the following solutions:

  1. Disable Safelinks for specific URLs:

    • You can disable Safelinks protection for specific URLs or domains. To do this, you’ll need to add the URL or domain to the “Trusted Sites” list in your Microsoft 365 settings.

    Here’s how:

    1. Go to the Microsoft 365 Admin Center.
    2. Navigate to Settings > Org settings > Services > URL protection.
    3. Under Customize URL protection, add the URL or domain you want to trust to the Trusted sites list.
  2. Disable Safelinks entirely:

    • If you’re not concerned about URL protection, you can disable Safelinks altogether. However, keep in mind that this reduces the security features provided by Microsoft.

    To disable Safelinks:

    1. Go to the Microsoft 365 Admin Center.
    2. Navigate to Settings > Org settings > Services > URL protection.
    3. Toggle the URL protection switch to the Off position.
  3. Use a third-party solution:

    • If you need to frequently access URLs from Teams and don’t want to disable Safelinks, consider using a third-party browser extension that can remove the Safelinks prefix. There are several extensions available, such as Safelink Remover or URL Unshortener.

Remember that disabling Safelinks or using a third-party solution may reduce the security features provided by Microsoft. Always ensure you’re accessing trusted URLs to minimize potential risks.