Fix the iCloud Calendar synch with Outlook PC issue.
iCloud on PC.
I had the iCloud Calendar synch with Outlook PC issue.
Claude found the bug:
What was wrong: the old iCloud app had left an entry in Office’s mail‑services file (MAPISVC.INF) pointing to a file it had since deleted. The new iCloud app writes its entry to a Windows folder that your Office version doesn’t read. So Office kept looking for the deleted file, and iCloud reported that it “did not install properly”. I pointed that entry at the new iCloud file, then restarted iCloud so it ran its setup again.
Claude wrote Powershell script to fix it. Crazy it worked.
Here it is but don't run it as is as I have no idea how safe it is and if it is adapted to your config, just ask Claude!
# Fix iCloud (APLZOD) entries in Office Click-to-Run mapisvc.inf for 64-bit Outlook.
# Makes a timestamped backup next to the file first. Only lines mentioning APLZOD are changed.
$me = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()
if (-not $me.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
exit
}
$report = New-Object System.Collections.Generic.List[string]
function L($s) { $report.Add([string]$s); Write-Host $s }
$out = Join-Path $PSScriptRoot 'icloud-outlook-fix-results.txt'
function Finish { $report -join "`r`n" | Set-Content -Path $out -Encoding UTF8; Write-Host ''; Read-Host 'Press Enter to close' | Out-Null; exit }
L "Run 2: $(Get-Date)"
$inf = 'C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX64\System\MSMAPI\1033\mapisvc.inf'
$dir = 'C:\ProgramData\Apple Inc\iCloud\Outlook'
if (Get-Process OUTLOOK -ErrorAction SilentlyContinue) { L 'STOP: Outlook (classic) is running. Close it and run this again.'; Finish }
if (-not (Test-Path $inf)) { L "STOP: not found: $inf"; Finish }
function Machine($f) { try { $b = [IO.File]::ReadAllBytes($f); $pe = [BitConverter]::ToInt32($b, 0x3C); return ('0x{0:X4}' -f [BitConverter]::ToUInt16($b, $pe + 4)) } catch { return 'unreadable' } }
$map = @{}
foreach ($n in 'aplzod32.dll','aplzod6432.dll') { $p = Join-Path $dir $n; if (Test-Path $p) { $m = Machine $p; $map[$n] = $m; L "$n machine=$m (0x8664 = 64-bit, 0x014C = 32-bit)" } else { L "$n missing" } }
$msiLog = Join-Path $env:LOCALAPPDATA 'Packages\AppleInc.iCloud_nzyj5cx40ttqa\LocalCache\Local\Logs\iCloudOutlook_Install.log'
if (Test-Path $msiLog) { L '--- Installer log (mapisvc writes):'; Select-String -Path $msiLog -Pattern 'IniFilePath|DLL_NAME' | ForEach-Object { $t = $_.Line; $i = $t.IndexOf('Executing op:'); if ($i -ge 0) { $t = $t.Substring($i + 14) }; L " $t" } }
# MAPI appends "32" to the DLL name: INF "APLZOD64.dll" loads aplzod6432.dll; INF "APLZOD.dll" loads aplzod32.dll
if ($map['aplzod6432.dll'] -eq '0x8664') { $name = 'APLZOD64.dll' }
elseif ($map['aplzod32.dll'] -eq '0x8664') { $name = 'APLZOD.dll' }
else { L 'STOP: no 64-bit iCloud Outlook DLL found.'; Finish }
$new = Join-Path $dir $name
L "Using: $new"
$bak = "$inf.bak2-$(Get-Date -Format yyyyMMdd-HHmmss)"
Copy-Item $inf $bak -Force
L "Backup saved: $bak"
$enc = [Text.Encoding]::Default
$text = [IO.File]::ReadAllText($inf, $enc)
L '--- Before:'; ($text -split "`r?`n") | Where-Object { $_ -match 'APLZOD' } | ForEach-Object { L " $_" }
$fixed = [regex]::Replace($text, '(?im)^(PR_(?:SERVICE_DLL_NAME|SERVICE_DELETE_FILES|SERVICE_SUPPORT_FILES|PROVIDER_DLL_NAME)=)[^\r\n]*APLZOD[^\r\n]*', { param($x) $x.Groups[1].Value + $new })
[IO.File]::WriteAllText($inf, $fixed, $enc)
L '--- After:'; ([IO.File]::ReadAllText($inf, $enc) -split "`r?`n") | Where-Object { $_ -match 'APLZOD' } | ForEach-Object { L " $_" }
L 'Done. Now open the iCloud app, switch Calendars and Contacts off and on again (Outlook closed), then open Outlook (classic).'