OneDrive “Sync Pending”: An Excel File Updated Online but Stuck Locally
Copyright Notice: This article is an original work licensed under the CC 4.0 BY-NC-ND license.
If you wish to repost this article, please include the original source link and this copyright notice.
Source link: https://v2know.com/article/1491
Read the Traditional Chinese version
A colleague had updated our progress spreadsheet. When I downloaded it from OneDrive online, I could see the latest contents. But opening the file with the same name in Windows File Explorer still showed data from the previous month. Both copies opened in Excel, and both appeared as 16 KB in the Size column. The local file had been showing blue sync arrows for days.
In this case, the immediate cause was that Windows denied the file-open request OneDrive needed to apply the newer version to the existing local file. After I added one local access right to the affected file, OneDrive completed the update on its own.
First, confirm which copy is newer
Using the same work account, I checked the folder path, filename, and version history online. File Explorer’s rounded size display had hidden the difference between the two copies.
| Check | Old copy in the local sync folder | Newer copy online |
|---|---|---|
| Last modified (2026, Japan Standard Time) | October 19, 09:19 | November 13, 16:16 |
| Exact size | 16,246 bytes | 16,339 bytes |
The copy supplied by my colleague had a content fingerprint matching the cloud version recorded by OneDrive. Starting at 16:18 on November 13, the local sync logs repeatedly recorded Win32::5 [AccessDenied] for this file. My colleague’s upload had completed; the failure was happening when my computer tried to apply the update.
Downloading and syncing involve different file operations. Downloading from the website into another folder creates a new file there. The sync client needed to open the existing old file on my D: drive so that the cloud version could replace it. Being able to view and download the online file is compatible with this local operation being denied.
Why was access denied when I already had Modify permission?
The old file inherited Windows Modify permission from its parent folder. In testing, opening it with access rights to read its data and delete the file itself succeeded. For this update, OneDrive also requested FILE_DELETE_CHILD (0x40), which the Windows icacls command represents as DC. Without that additional right, Windows denied the open request.
That access right normally concerns deleting child items in a directory. The available records do not establish why this version of the client requested it for an ordinary Excel file. Microsoft documents the constant in its Windows file access rights reference.
I repeated the comparison outside the sync folder, using a copy with the same contents and permissions. Adding DC to that one copy made the open test succeed. Removing it brought the same test back to error 5.
The company had also recently granted Microsoft Graph permissions to a CLI tool. Those permissions govern how the tool accesses cloud data, as described in Microsoft’s Microsoft Graph permissions overview. The change that restored syncing in this case was to the local file’s Windows permissions.
How I would handle the same symptoms again
1. Find the actual stuck file and preserve both versions
Follow the Status column down through the folders in File Explorer until you find the file showing blue arrows. Select the OneDrive cloud icon in the taskbar, confirm that syncing is running, and check for messages about paused syncing, sign-in, or a file being in use.
Blue arrows also appear during normal transfers, so the icon alone does not establish that permissions need changing. Microsoft explains the OneDrive icons and common causes of a file failing to sync.
Confirm online that the same path has a newer version, then download a comparison copy outside every OneDrive sync folder. Use the online version history to establish which version is newer. A download date only tells you when you obtained the copy, and different content fingerprints only tell you that the contents differ.
The repair below applies when the cloud copy is the newer version you want to keep, and the local copy is an older version that can be replaced. If the local file contains offline edits or unsaved changes, or you are unsure which version to keep, save the local contents outside the sync area first. Compare both copies and preserve the changes you need. Once the versions are confirmed, close this workbook in Excel and leave OneDrive running.
2. Use two open tests to identify the same access-rights problem
Open a normal, non-elevated PowerShell window using the Windows account that normally runs OneDrive. Run the following steps in that same window. In File Explorer, select the file and use Copy as path to obtain its full path.
The test below requests a handle to the existing file and immediately closes it. It does not write or delete its contents.
Expand the PowerShell open tests for step 2
$localFile = $null
$p = (Read-Host 'Paste the full path of the file waiting to sync in OneDrive').Trim().Trim('"')
$localFile = Get-Item -LiteralPath $p -ErrorAction Stop
if ($localFile -isnot [IO.FileInfo]) { throw 'Select a file.' }
function Test-OpenCode([IO.FileInfo]$item, [int]$mask) {
$rights = [Security.AccessControl.FileSystemRights]$mask
$stream = $null
try {
if ($PSVersionTable.PSEdition -eq 'Desktop') {
$stream = [IO.FileStream]::new($item.FullName, 'Open', $rights, 'Read', 4096, 'None')
} else {
$stream = [IO.FileSystemAclExtensions]::Create($item, 'Open', $rights, 'Read', 4096, 'None', $null)
}
return 0
} catch {
$cause = $_.Exception.GetBaseException()
if ($cause -is [UnauthorizedAccessException] -or $cause -is [IO.IOException]) {
return ($cause.HResult -band 0xFFFF)
}
throw
} finally {
if ($null -ne $stream) { $stream.Dispose() }
}
}
[pscustomobject]@{
'Basic open' = Test-OpenCode $localFile 0x10001
'With DC' = Test-OpenCode $localFile 0x10041
}
| Result (Basic open / With DC) | Interpretation |
|---|---|
| 0 / 5 | The basic request succeeds, but adding DC causes access to be denied. If the version conditions in step 1 also match, proceed to step 3. |
| 0 / 0 | Windows already allows both requests. Check the other errors OneDrive reports for this file. |
| 32 in either field | A file-sharing conflict is preventing the open request. Close applications using this file, then test again. |
| Any other combination | Keep the error codes and file path, and investigate the actual error. |
3. Back up the old file and its permissions, then repair only this file
The script below repeats the open tests, compares the local file with the downloaded web copy, and backs up the old contents and original permissions to a separate directory under %LOCALAPPDATA%\OneDrive-Sync-Backups. It checks the backup’s content fingerprint and prints the backup location.
The actual repair uses icacls /grant to add (DC) for the current Windows account on this one file. Keep the permission change limited to the individual file. Granting DC on a folder affects the ability to delete child items, and /T extends the operation into subdirectories. See Microsoft’s icacls command reference.
Expand the backup and single-file repair script for step 3
$cloudCopy = $null
$p = (Read-Host 'Paste the path of the newer web copy downloaded outside the sync folder').Trim().Trim('"')
$cloudCopy = Get-Item -LiteralPath $p -ErrorAction Stop
$backupDir = Join-Path $env:LOCALAPPDATA ('OneDrive-Sync-Backups\' + [guid]::NewGuid().ToString('N'))
& {
$ErrorActionPreference = 'Stop'
if ($localFile -isnot [IO.FileInfo] -or $cloudCopy -isnot [IO.FileInfo] -or
$localFile.FullName -eq $cloudCopy.FullName) { throw 'Select two different files.' }
if ((Test-OpenCode $localFile 0x10001) -ne 0 -or
(Test-OpenCode $localFile 0x10041) -ne 5) { throw 'The open-test results differ from this case. Check the OneDrive error message.' }
$oldHash = (Get-FileHash -LiteralPath $localFile.FullName -Algorithm SHA256).Hash
$webHash = (Get-FileHash -LiteralPath $cloudCopy.FullName -Algorithm SHA256).Hash
if ($oldHash -eq $webHash) { throw 'The two files already have identical contents. Check the sync status again.' }
$null = [IO.Directory]::CreateDirectory($backupDir)
$savedFile = Join-Path $backupDir $localFile.Name
$savedAcl = Join-Path $backupDir 'original-permissions.acl'
Copy-Item -LiteralPath $localFile.FullName -Destination $savedFile
if ((Get-FileHash -LiteralPath $savedFile -Algorithm SHA256).Hash -ne $oldHash) {
throw 'Backup content verification failed.'
}
$dacl = (Get-Acl -LiteralPath $localFile.FullName).GetSecurityDescriptorSddlForm('Access')
icacls.exe $localFile.FullName /save $savedAcl /Q
if ($LASTEXITCODE -ne 0) { throw 'The original permissions could not be backed up.' }
$aclLines = [IO.File]::ReadAllLines($savedAcl, [Text.Encoding]::Unicode)
if ($aclLines -notcontains $dacl -or $aclLines -notcontains $localFile.Name) {
throw 'The saved filename or permissions could not be verified.'
}
Write-Host "The old file and its original permissions were backed up to $backupDir"
if ((Get-FileHash -LiteralPath $localFile.FullName -Algorithm SHA256).Hash -ne $oldHash) {
throw 'The local file has just changed. Compare the two versions again.'
}
$account = [Security.Principal.WindowsIdentity]::GetCurrent().Name
icacls.exe $localFile.FullName /grant ('{0}:(DC)' -f $account)
if ($LASTEXITCODE -ne 0) { throw 'The permission change failed. Keep the error message shown above.' }
}
4. Let OneDrive apply the newer version, then verify the contents
Allow OneDrive to complete its next retry, then check that file’s status. On my Japanese Windows installation, it changed from 同期保留中 (Sync pending) to このデバイスで使用可能 (Available on this device). In the same PowerShell window, run the following commands to calculate and compare the SHA-256 hashes of the local file and the downloaded cloud copy.
& {
$ErrorActionPreference = 'Stop'
if ($localFile -isnot [IO.FileInfo] -or $cloudCopy -isnot [IO.FileInfo] -or
$localFile.FullName -eq $cloudCopy.FullName) { throw 'Select two different files.' }
$localHash = (Get-FileHash -LiteralPath $localFile.FullName -Algorithm SHA256).Hash
$cloudHash = (Get-FileHash -LiteralPath $cloudCopy.FullName -Algorithm SHA256).Hash
$localHash -eq $cloudHash
}
If the file is no longer pending and the result is True, the local file now has exactly the same contents as that downloaded cloud copy. If the result is False, first check whether your colleague updated the cloud version again during verification. If the open tests now return 0 / 0 but syncing remains stuck, record the retry time and the new OneDrive error for your support team.
In this incident, the same repair restored syncing for three Excel files: a progress spreadsheet, a comparison spreadsheet, and a unit test report. After I repaired the second file, the parent folder already showed an online-availability status, even though the final report was still waiting.
It was not until 13:19 on November 19, 2026 (Japan Standard Time) that all three files individually showed they had synced, the final file’s content fingerprint matched, and the count of this type of pending update in the work OneDrive account dropped from 1 to 0. For future checks, I will use the individual file’s status and contents to decide whether the repair is complete.
Optional: undoing the permission change
If you need to undo step 3 while the local file is still the same old copy, and no other permission changes have occurred in the meantime, use the saved permissions to restore this file’s access rules in the same PowerShell window. The content backup and the permission backup are separate; the commands below restore only the permissions. Once OneDrive has successfully applied the newer version, you can generally leave the repair in place.
& {
$ErrorActionPreference = 'Stop'
$savedAcl = Join-Path $backupDir 'original-permissions.acl'
$lines = [IO.File]::ReadAllLines($savedAcl, [Text.Encoding]::Unicode)
if ($lines.Length -ne 2 -or $lines[0] -ne $localFile.Name -or $lines[1] -notlike 'D:*') {
throw 'The saved permissions do not match this file.'
}
$savedFile = Join-Path $backupDir $localFile.Name
if ((Get-FileHash -LiteralPath $localFile.FullName -Algorithm SHA256).Hash -ne
(Get-FileHash -LiteralPath $savedFile -Algorithm SHA256).Hash) {
throw 'The local contents have changed. Keep the newer file and the backups.'
}
$acl = [Security.AccessControl.FileSecurity]::new()
$acl.SetSecurityDescriptorSddlForm($lines[1], 'Access')
if ($PSVersionTable.PSEdition -eq 'Desktop') {
[IO.File]::SetAccessControl($localFile.FullName, $acl)
} else {
[IO.FileSystemAclExtensions]::SetAccessControl($localFile, $acl)
}
}
This article was last edited at