# Alternative fix: Use calendar folder permissions (delegate access)
# This bypasses the sharing policy entirely

# Connect to Exchange Online
Connect-ExchangeOnline

# Grant Leeann permission to Jim's calendar directly
Write-Host "`n=== Granting Calendar Permissions ===" -ForegroundColor Cyan

# Option 1: Reviewer access (read-only, see all details)
Add-MailboxFolderPermission -Identity "jim@jparkinsonaz.com:\Calendar" -User "leeann@lamaddux.com" -AccessRights Reviewer

# Option 2: Editor access (read + create/edit items) - uncomment if needed
# Add-MailboxFolderPermission -Identity "jim@jparkinsonaz.com:\Calendar" -User "leeann@lamaddux.com" -AccessRights Editor

Write-Host "`nCalendar permissions granted successfully." -ForegroundColor Green

# Verify the permissions
Write-Host "`n=== Current Calendar Permissions ===" -ForegroundColor Cyan
Get-MailboxFolderPermission -Identity "jim@jparkinsonaz.com:\Calendar" | Format-Table User, AccessRights

Write-Host "`n=== Next Steps ===" -ForegroundColor Yellow
Write-Host "1. Leeann should open Outlook"
Write-Host "2. Go to File > Account Settings > Account Settings > Internet Calendars"
Write-Host "3. Or in Outlook: Add Calendar > From Address Book > select Jim Parkinson"
Write-Host "4. Jim's calendar will appear in her calendar list"
Write-Host ""
Write-Host "NOTE: This uses delegate permissions, not 'sharing' - bypasses the policy restriction."
