When opening, creating or saving an Office document, spreadsheet or presentation on SharePoint Document Library or Microsoft OneDrive (can be part of Office 365 service) with Microsoft Office applications such as Word, Excel or PowerPoint , the following warning message may appear:

Some files can harm your computer. If the file information below looks suspicious, or you do not fully trust the source, do not open the file.

File Name: sample.docx
From: domain.sharepoint.com

Or,

Some files can contain viruses or otherwise be harmful to your computer. It is important to be certain that this file is from a trustworthy source.

Do you want to open this file?

Program: Microsoft Word
Address: https://d.docs.live.net/url/sample.docx

Microsoft Office File Contains Virus or Harmful

The warning message is a security feature of Microsoft Office to protect against malicious attack. This is because editing the file in the cloud with a local application requires Office program to download a temporary file to local device before you’re able to view and edit it.

To resolve the issue where the warning message appears every time you try to open a file stored in SharePoint or OneDrive, try one of the following methods.

Add the URL of SharePoint or OneDrive as Trusted Sites

  1. Open Control Panel.
  2. Go to Network and Internet -> Internet Options.
  3. In the “Internet Properties” dialog, go to Security tab.
  4. Select Trusted sites zone.
  5. Click or tap on Sites button that appears.

    Trusted Sites

  6. Enter the domain part of the URL of the SharePoint or OneDrive storage space in the text box under “Add this website to the zone” heading, and hit the Add button. For example:

    https://companydomain.sharepoint.com

    Add URL / Domain to Trusted Sites

    You can use a wildcard, which is an asterisk character (*), to include all transport protocols used by a specific Web address and all the sub-domains in a specific domain. For example,

    https://*.sharepoint.com
    *://*.sharepoint.com

    Note
    You should add the source site URL to the Trusted Sites list even if you don’t use Internet Explorer (IE) web browser, Trusted Sites List is a system-wide setting, not an IE setting.
  7. Open the Office file again and the warning prompt should be gone.
Note
The above setting configures the following registry key and value, where 2 indicates Trusted Sites zone in Internet Options:

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMapKey]
“https://companydomain.sharepoint.com”=”2”

Install OneDrive or OneDrive for Business Client

Installing OneDrive or OneDrive for Business client to sync the files between local PC and the files on the cloud in OneDrive or SharePoint.

With OneDrive client, all files can be accessed in File Explorer or Windows Explorer in a local folder. After syncing the files, create, save and edit the local files with Office applications, which then will be synced automatically to the cloud by the client. As the files are now local (not downloaded from Internet), no warning will be prompted.