Repository: microsoft/CSS-Exchange
File: Calendar/Check-SharingStatus.ps1 (PowerShell)

Code before:

    Write-Host -ForegroundColor DarkYellow "Owner Modern Sharing Sent Invites"
    ProcessCalendarSharingInviteLogs -Identity $Owner

    Write-Host -ForegroundColor DarkYellow "Owner Calendar Folder Information:"
    Write-Host -ForegroundColor DarkYellow "`t Running 'Get-MailboxCalendarFolder "${Owner}:\$OwnerCalendarName"'"

    $OwnerCalendarFolder = Get-MailboxCalendarFolder "${Owner}:\$OwnerCalendarName"
    if ($OwnerCalendarFolder.PublishEnabled) {
        Write-Host -ForegroundColor Green "Owner Calendar is Published."
        $script:OwnerPublished = $true
    } else {
        Write-Host -ForegroundColor Yellow "Owner Calendar is not Published."
        $script:OwnerPublished = $false
    }

    if ($OwnerCalendarFolder.ExtendedFolderFlags.Contains("SharedOut")) {
        Write-Host -ForegroundColor Green "Owner Calendar is Shared Out using Modern Sharing."
        $script:OwnerModernSharing = $true
    } else {
        Write-Host -ForegroundColor Yellow "Owner Calendar is not Shared Out."
        $script:OwnerModernSharing = $false
    }

    Write-Host -ForegroundColor DarkYellow "`t Running 'Get-MailboxCalendarFolder -Identity "${Owner}:\$OwnerCalendarName"'"
    $CalFolderProps = Get-MailboxCalendarFolder -Identity "${Owner}:\$OwnerCalendarName"
    Write-Host -ForegroundColor DarkYellow "`t ExtendedFolderFlags: $($CalFolderProps.ExtendedFolderFlags)"
    if ($CalFolderProps.ExtendedFolderFlags -like "*SharedOut*") {
        Write-Host -ForegroundColor Green "`t Calendar is Shared Out using Modern Sharing."
    } else {
        Write-Host -ForegroundColor Red "`t Calendar is not Shared Out using Modern Sharing."
    }

    Write-Host -ForegroundColor DarkYellow "`t Running 'Get-CalendarActiveSharingInformation -Identity "${Owner}:\$OwnerCalendarName"'"
    $OwnerActiveSharingInfo = Get-CalendarActiveSharingInformation -Identity "${Owner}:\$OwnerCalendarName"
    if ($OwnerActiveSharingInfo.ActiveShareesDataSet.Sharees.count -gt 0) {
        Write-Host -ForegroundColor Green "`t Calendar has [$($OwnerActiveSharingInfo.ActiveShareesDataSet.Sharees.count)] Active Receivers."
        $receivers = $OwnerActiveSharingInfo.ActiveShareesDataSet.Sharees | ForEach-Object {
            [PSCustomObject]@{
                EmailAddress          = $_.EmailAddress
                SharingPermissionFlag = ($_.SharingPermissionFlags -join ",")
                LastSyncTime          = $_.LastSyncTime
            }
        }
        Write-Host -ForegroundColor DarkYellow "Look for the Receiver [$Receiver] in the list of Active Receivers."

        $receivers | Format-Table -AutoSize EmailAddress, SharingPermissionFlag, LastSyncTime
    } else {
        Write-Host -ForegroundColor Yellow "`t Calendar has no Active Receivers according to Get-CalendarActiveSharingInformation."
    }
    Write-Host -ForegroundColor DarkYellow "`n`n`n------------------------------------------------"

Review comment (suggestion):
Spell Check is currently complaining about this. 

<img width="577" height="169" alt="Image" src="https://github.com/user-attachments/assets/9a5d13b3-ec2c-4cc0-bf46-1d27ac6e9214" />

Based off code review internally, this looks like the correct spelling of it. 

Therefore, we need to tell Spell Check to ignore this word. If this is the only location of this, then you can just add it to the file like so: 

```
# cSpell:ignore ActiveShareesDataSet
```

Or if we think this might be used in different locations down the road, let's just add it to the main database of words to ignore.  #Resolved

Code after:
        $script:OwnerPublished = $true
    } else {
        Write-Host -ForegroundColor Yellow "Owner Calendar is not Published."
        $script:OwnerPublished = $false
    }

    if ($OwnerCalendarFolder.ExtendedFolderFlags.Contains("SharedOut")) {
        Write-Host -ForegroundColor Green "Owner Calendar is Shared Out using Modern Sharing."
        $script:OwnerModernSharing = $true
    } else {
        Write-Host -ForegroundColor Yellow "Owner Calendar is not Shared Out."
        $script:OwnerModernSharing = $false
    }

    Write-Host -ForegroundColor DarkYellow "`t Running 'Get-MailboxCalendarFolder -Identity "${Owner}:\$OwnerCalendarName"'"
    $CalFolderProps = Get-MailboxCalendarFolder -Identity "${Owner}:\$OwnerCalendarName"
    Write-Host -ForegroundColor DarkYellow "`t ExtendedFolderFlags: $($CalFolderProps.ExtendedFolderFlags)"
    if ($CalFolderProps.ExtendedFolderFlags -like "*SharedOut*") {
        Write-Host -ForegroundColor Green "`t Calendar is Shared Out using Modern Sharing."
    } else {
        Write-Host -ForegroundColor Red "`t Calendar is not Shared Out using Modern Sharing."
    }

    # cSpell:ignore Sharees
    Write-Host -ForegroundColor DarkYellow "`t Running 'Get-CalendarActiveSharingInformation -Identity "${Owner}:\$OwnerCalendarName"'"
    $OwnerActiveSharingInfo = Get-CalendarActiveSharingInformation -Identity "${Owner}:\$OwnerCalendarName"
    if ($OwnerActiveSharingInfo.ActiveShareesDataSet.Sharees.count -gt 0) {
        Write-Host -ForegroundColor Green "`t Calendar has [$($OwnerActiveSharingInfo.ActiveShareesDataSet.Sharees.count)] Active Receivers."
        $receivers = $OwnerActiveSharingInfo.ActiveShareesDataSet.Sharees | ForEach-Object {
            [PSCustomObject]@{
                EmailAddress          = $_.EmailAddress
                SharingPermissionFlag = ($_.SharingPermissionFlags -join ",")
                LastSyncTime          = $_.LastSyncTime
            }
        }
        Write-Host -ForegroundColor DarkYellow "Look for the Receiver [$Receiver] in the list of Active Receivers."

        $receivers | Format-Table -AutoSize EmailAddress, SharingPermissionFlag, LastSyncTime
    } else {
        Write-Host -ForegroundColor Yellow "`t Calendar has no Active Receivers according to Get-CalendarActiveSharingInformation."
    }
    Write-Host -ForegroundColor DarkYellow "`n`n`n------------------------------------------------"
}

<#
.SYNOPSIS
    Displays key information from the receiver of the shared Calendar.
.DESCRIPTION
    This function displays key Calendar Receiver information.
.PARAMETER Identity
    The SMTP Address for Receiver of the shared calendar.