Skip to content

Quick exceptions#2529

Merged
dpaulson45 merged 6 commits intomainfrom
QuickExceptions
Apr 27, 2026
Merged

Quick exceptions#2529
dpaulson45 merged 6 commits intomainfrom
QuickExceptions

Conversation

@Shanefe
Copy link
Copy Markdown
Contributor

@Shanefe Shanefe commented Apr 22, 2026

Collection CalLogs Exceptions used to use a N matrix with the number of logs.
New functionality is for N x number of dates, much quicker.
Other minor fixes.

Getting the dates requires cracking the Recurrence blob, which is in the new file.

@Shanefe Shanefe requested a review from a team as a code owner April 22, 2026 00:21
Copilot AI review requested due to automatic review settings April 22, 2026 00:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a faster recurring-meeting exception collection path for Get-CalendarDiagnosticObjectsSummary.ps1 by parsing AppointmentRecurrenceBlob to identify exception dates up-front, plus related improvements to exports/timeline and Subject-search behavior.

Changes:

  • Add -FastExceptions/-AllExceptions and implement blob-based exception-date discovery with legacy fallback.
  • Improve Subject-search flow to optionally collect exceptions when exactly one MeetingID is resolved.
  • Adjust Enhanced/Raw export behavior (sorting, deduping, additional run/exception telemetry) and update timeline exception handling.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/Calendar/Get-CalendarDiagnosticObjectsSummary.md Documents the new fast exception-collection mode and updated Subject-search caveats.
Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 Adds new parameters, state tracking, and wires in the new exception-collection helper module.
Calendar/CalLogHelpers/ExceptionCollectionFunctions.ps1 New helper implementing fast exception-date parsing and exception-log collection (plus dedupe/merge helpers).
Calendar/CalLogHelpers/Invoke-GetCalLogs.ps1 Adds per-exception-date override support and updates Subject-search to conditionally collect exceptions.
Calendar/CalLogHelpers/ExportToExcelFunctions.ps1 Updates Enhanced/Raw/Timeline Excel export behavior and adds collection telemetry.
Calendar/CalLogHelpers/CalLogCSVFunctions.ps1 Adds exception-type helpers, improved sorting utilities, dedupe integration, and organizer identity mapping.
Calendar/CalLogHelpers/TimelineFunctions.ps1 Uses new exception-type helper and adds timeline ordering validation.
Calendar/CalLogHelpers/CreateTimelineRow.ps1 Broadens exception matching to Exception* and uses the new exception-log helper.
Calendar/CalLogHelpers/CalLogExportFunctions.ps1 Exports Enhanced output from $script:EnhancedCalLogs rather than a local projection.
Calendar/CalLogHelpers/FindChangedPropFunctions.ps1 Refines “meaningful change” checks and suppresses organizer “changes” when identity representations differ.
Comments suppressed due to low confidence (1)

Calendar/CalLogHelpers/ExportToExcelFunctions.ps1:449

  • GetExcelParams no longer sets -Append, and the call sites use Export-Excel -Path $FileName ... without -Append/-ExcelPackage. With multiple identities (or when adding tabs later), this will overwrite the existing workbook instead of adding/updating worksheets. Add Append = $true (and keep ClearSheet if you want to replace an existing sheet) or refactor to reuse a single -ExcelPackage for the whole export.
    return @{
        Path                    = $path
        FreezeTopRow            = $true
        #  BoldTopRow              = $true
        Verbose                 = $false
        TableStyle              = $TableStyle
        WorksheetName           = $tabName
        TableName               = $tabName
        FreezeTopRowFirstColumn = $true
        AutoFilter              = $true
        ClearSheet              = $true
        Title                   = "Enhanced Calendar Logs for $Identity" + $TitleExtra + " for MeetingID [$($script:GCDO[0].CleanGlobalObjectId)]."
        TitleSize               = 14
        ConditionalText         = $ConditionalFormatting
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Calendar/CalLogHelpers/ExportToExcelFunctions.ps1
Comment thread Calendar/CalLogHelpers/ExceptionCollectionFunctions.ps1
Comment thread Calendar/CalLogHelpers/Invoke-GetCalLogs.ps1
Comment thread Calendar/CalLogHelpers/ExceptionCollectionFunctions.ps1
Comment thread Calendar/CalLogHelpers/ExceptionCollectionFunctions.ps1
@Shanefe
Copy link
Copy Markdown
Contributor Author

Shanefe commented Apr 22, 2026

@copilot apply changes based on the comments in this thread

@dpaulson45 dpaulson45 requested a review from Copilot April 24, 2026 19:52
@dpaulson45
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Calendar/CalLogHelpers/ExceptionCollectionFunctions.ps1 Outdated
Comment thread Calendar/CalLogHelpers/CalLogCSVFunctions.ps1 Outdated
Comment on lines +583 to +588
$script:GCDO = RemoveDuplicateCalendarDiagnosticObjects -CalLogs $script:GCDO
$rawNullCount = @($script:GCDO).Count - @($script:GCDO | Where-Object { $null -ne $_ }).Count
if ($rawNullCount -gt 0) {
Write-Host -ForegroundColor Yellow "Removed [$rawNullCount] null raw calendar log row(s) before processing."
}
$script:GCDO = @($script:GCDO | Where-Object { $null -ne $_ })
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BuildCSV calls RemoveDuplicateCalendarDiagnosticObjects on $script:GCDO before creating the RAW export. That helper currently sorts the returned logs by LogTimestamp, which changes the original collection order. This conflicts with the later intent/comments that RAW output should remain in collected order; consider de-duping while preserving original order (no sort) and only sorting the Enhanced projection.

Suggested change
$script:GCDO = RemoveDuplicateCalendarDiagnosticObjects -CalLogs $script:GCDO
$rawNullCount = @($script:GCDO).Count - @($script:GCDO | Where-Object { $null -ne $_ }).Count
if ($rawNullCount -gt 0) {
Write-Host -ForegroundColor Yellow "Removed [$rawNullCount] null raw calendar log row(s) before processing."
}
$script:GCDO = @($script:GCDO | Where-Object { $null -ne $_ })
# De-duplicate while preserving the original collection order for RAW output.
$rawNullCount = @($script:GCDO).Count - @($script:GCDO | Where-Object { $null -ne $_ }).Count
if ($rawNullCount -gt 0) {
Write-Host -ForegroundColor Yellow "Removed [$rawNullCount] null raw calendar log row(s) before processing."
}
$dedupedCalLogs = New-Object 'System.Collections.Generic.List[object]'
$seenCalLogKeys = New-Object 'System.Collections.Generic.HashSet[string]'
foreach ($calLog in @($script:GCDO | Where-Object { $null -ne $_ })) {
$calLogKey = $calLog | ConvertTo-Json -Compress -Depth 10
if ($seenCalLogKeys.Add($calLogKey)) {
[void]$dedupedCalLogs.Add($calLog)
}
}
$script:GCDO = @($dedupedCalLogs)

Copilot uses AI. Check for mistakes.
Comment thread Calendar/CalLogHelpers/ExceptionCollectionFunctions.ps1
Comment thread Calendar/CalLogHelpers/ExceptionCollectionFunctions.ps1
Shanefe and others added 2 commits April 24, 2026 13:47
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…erve RAW order in BuildCSV dedup

Agent-Logs-Url: https://github.com/microsoft/CSS-Exchange/sessions/a475f1cd-4da3-4c2b-866d-22353ec0a42a

Co-authored-by: Shanefe <6235087+Shanefe@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

@copilot apply changes based on the comments in this thread

Applied all feedback from the review thread in commit 6741d8f:

  • Removed unary commas from both return statements in Convert-AppointmentRecurrenceBlobToBytes so callers receive a proper [byte[]]
  • Replaced the RemoveDuplicateCalendarDiagnosticObjects call in BuildCSV with an order-preserving dedup (using HashSet + List) so the RAW output retains the original collection order

@dpaulson45
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@dpaulson45 dpaulson45 merged commit a180a03 into main Apr 27, 2026
8 checks passed
@dpaulson45 dpaulson45 deleted the QuickExceptions branch April 27, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants