Home › OneDrive for Business › 0x80070005

OneDrive for Business · 0x80070005 · Windows 11 22H2

OneDrive for Business Sync Fails with 0x80070005 Access Denied - Windows 11 22H2

Access denied error due to NTFS ACL changes or AV exclusions missing; fix by verifying permissions and adding OneDrive.exe to antivirus exclusion list.

Error Details

FactValueSourceNote
Exact error string0x80070005Event Viewer - Application Log-> Event ID 22
Affected build rangeWindows 11 22H2OS Build Information
Registry key involvedHKCU\Software\Microsoft\OneDriveRegistry Editor-> Permissions
Relevant service/endpoint URLhttps://aka.ms/onedrive/troubleshootMicrosoft Support Website
Log line signatureEvent ID 22 - OneDrive process failed to write fileApplication Log

Log Files to Check

What This Error Actually Means

The error code 0x80070005 is a generic access denied error, which means that the OneDrive for Business process does not have sufficient permissions to perform an operation on a file or folder. In this specific context, it indicates that the OneDrive.exe process cannot write to the local sync folder due to issues with NTFS Access Control Lists (ACLs), antivirus exclusions, or conflicts arising from Known Folder Moves (KFM) involving redirected Desktop and Documents folders. The error is raised by the OneDrive service when attempting to synchronize files between a user's local machine and their cloud storage.

Affected Versions and Scope

This issue primarily affects Windows 11 build 22H2, as detailed in OS Build Information. It can occur across various tenant configurations but is particularly prevalent where there are strict security policies or when using Group Policy to manage folder redirection. The error does not typically appear on earlier versions of Windows 10 or other operating systems that do not use the same synchronization mechanisms employed by OneDrive for Business.

Where To Look First: Logs and Event IDs

To diagnose this issue, you should first examine the Application event log located at C:\Windows\System32\winevt\Logs\Application.evtx. Specifically, look for entries with Event ID 22, which detail when the OneDrive process fails to write a file. These logs will provide critical information about the exact nature of the access denied error and can help pinpoint whether it is related to NTFS permissions or antivirus exclusions. Additionally, review the setup log located at C:\Users\\AppData\Local\Microsoft\OneDrive\logs\setup.log. This file contains detailed logs from OneDrive's initial setup process and subsequent synchronization attempts. Look for any lines indicating permission issues or errors related to folder redirection conflicts.

Root Causes

NTFS ACL Changes

If the NTFS permissions on the user’s OneDrive folder have been altered, it can cause this error. This often happens when security policies are updated and applied via Group Policy Objects (GPO) or manually by administrators. To identify if this is the root cause, run the following PowerShell cmdlet to check the current ACL settings: icacls "%UserProfile%\OneDrive" This command will display the permissions set on the OneDrive folder. Compare these with what is expected based on your organization's security policies and ensure that the OneDrive service account has write access.

Antivirus Exclusions Missing

If an antivirus solution is installed and configured to scan files as they are written, it can interfere with OneDrive’s ability to sync files. Ensure that the OneDrive executable and folder paths are excluded from real-time scanning by your AV software. To verify exclusions in Windows Defender Security Center: 1. Open Settings > Update & Security > Windows Security. 2. Click on Virus & threat protection > Manage settings. 3. Under Exclusions, add C:\Users\\OneDrive and the path to OneDrive.exe if not already excluded.

Known Folder Move (KFM) Conflict with Redirected Folders

When a user’s Desktop or Documents folder is redirected via Group Policy but also has a Known Folder Move applied, conflicts can arise. This situation often leads to issues where OneDrive cannot write files due to conflicting paths and permissions. To resolve this issue, check the registry key HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders for any redirection settings that might conflict with KFM. Use the following PowerShell cmdlet to inspect these values: Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" | Select-Object *Desktop*,*Documents* Compare the output against expected folder paths and adjust if necessary.

Fix Procedure

To resolve this issue, follow these steps: 1. **Check NTFS Permissions:** - Open Command Prompt as Administrator. - Run icacls "%UserProfile%\OneDrive". - Ensure that the OneDrive service account has full control over the folder. 2. **Add AV Exclusions:** - Navigate to Windows Defender Security Center > Virus & threat protection settings > Manage exclusions. - Add C:\Users\\OneDrive and the path to OneDrive.exe if necessary. 3. **Adjust Folder Redirection Settings:** - Use Group Policy Management Console (GPMC) or Intune admin center > Devices > Configuration Profiles to adjust folder redirection settings. - Ensure that KFM does not conflict with redirected folders by reviewing HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders. 4. **Reset OneDrive:** If the above steps do not resolve the issue, you can reset OneDrive using: - Open Command Prompt as Administrator. - Run onedrive.exe /reset.
Note: The reset command will delete all local files and folders in the OneDrive folder. Ensure that users have a backup before proceeding.

Error Code Variants

Error Code Description Distinguishing Factors
0x80070005 Access Denied - OneDrive cannot write to sync folder. This error is specific to permission issues on the local file system.
0x80071392 Cannot connect to server - network issue. Different from 0x80070005 as it relates to connectivity rather than permissions.
0x80070490 Cannot access file due to offline status - sync issues. This error is related to the OneDrive client being in an offline mode, not a permission issue.

Verification

After applying the fixes, verify that the problem has been resolved by checking for Event ID 22 in the Application log. Look for lines indicating successful file writes without access denied errors. Additionally, review C:\Users\\AppData\Local\Microsoft\OneDrive\logs\setup.log to confirm that OneDrive is now able to synchronize files properly.

Prevention

To prevent recurrence of this issue, implement the following baseline changes: 1. **Policy Management:** - Use Intune admin center > Policies > Windows policies to enforce consistent NTFS permissions across all devices. 2. **AV Configuration:** - Ensure that antivirus exclusions are correctly configured for OneDrive paths via Group Policy or Intune. 3. **Folder Redirection:** - Review and adjust folder redirection settings in GPMC or Intune admin center > Devices > Configuration Profiles to avoid conflicts with Known Folder Moves.
TIP: Use the OMA-URI ./Device/Vendor/MSFT/OneDrive/FolderRedirection in Intune policies to manage folder redirection settings more granularly.
By following these guidelines, you can effectively troubleshoot and prevent issues related to OneDrive for Business sync failures on Windows 11 build 22H2.

Sources & References

Related Guides

Get new error code fixes by email

Product-specific solutions for Intune, Autopilot, SCCM and Entra ID — straight to your inbox. No spam.