Skip to content

New-MgUserCalendarEvent creating duplicate entries  #2960

@TWells94

Description

@TWells94

Describe the bug

Duplicate entries are getting added for one reseult. The exemple params would be

$CalendarSubject = "New Event"
$StartDate = "yyyy-MM-ddT00:00:00"
$DayAfter= "yyyy-MM-ddT00:00:00"
$AllDay = $True

$params = @{
                Subject = $CalendarSubject
                Body = @{
                    ContentType = "HTML"
                    Content = "Synced from Rapport."
                }
                Start = @{
                    DateTime = $StartDate
                    TimeZone = "Pacific Standard Time"
                }
                End = @{
                    DateTime = $DayAfter
                    TimeZone = "Pacific Standard Time"
                }
                ShowAs = "oof"
                
                IsAllDay = $AllDay

            }

            
            # Create the event
       $Event = New-MgUserCalendarEvent -UserId $UserID -CalendarId $CalendarID -BodyParameter $params

The example screenshot below is from running this once. It seems to add multiple values for some and a single value for others.

I have checked through the results and none of them include duplicate values, i've also removed the "$Event =" and seen it appaears to only add one event but checking the calendar it adds 2.
image

I've ran it without making the command a variable and it is only showing

Expected behavior

To add one singular value based on the inputs given.

How to reproduce

I have attached a copy of my script but leaving out the inital call (However the example data is copied in the same format)

This is what seems to give 2 copies of the same event entry, at line 112 i even filter out any duplicates based on the start date.

Example_Calendar_Github.txt

SDK Version

2.23.0

Latest version known to work for scenario above?

No response

Known Workarounds

None

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions