microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
712 stars 172 forks source link

New-MgUserCalendarEvent creating duplicate entries #2960

Closed TWells94 closed 3 weeks ago

TWells94 commented 1 month ago

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 ``` ```

Configuration

No response

Other information

No response

timayabi2020 commented 1 month ago

@TWells94 thank you for logging this issue. Please use Invoke-MgGraphRequest cmdlet and let us know if you are still having the same experience. Please use the sample request below. Maybe there is something causing a duplicate web request.

$params = @{
    subject = "Let's go for lunch"
    body = @{
        contentType = "HTML"
        content = "Does mid month work for you?"
    }
    start = @{
        dateTime = "2019-03-15T12:00:00"
        timeZone = "Pacific Standard Time"
    }
    end = @{
        dateTime = "2019-03-15T14:00:00"
        timeZone = "Pacific Standard Time"
    }
    location = @{
        displayName = "Harry's Bar"
    }
    attendees = @(
        @{
            emailAddress = @{
                address = "adelev@contoso.com"
                name = "Adele Vance"
            }
            type = "required"
        }
    )
    transactionId = "7E163156-7762-4BEB-A1C6-729EA81755A7"
}
Invoke-mggraphrequest -Uri 'https://graph.microsoft.com/v1.0/users/<UserId>/calendars/<CalendarId>/events' -Method POST -Body $Params -debug
TWells94 commented 1 month ago

Hi Tim,

I've tested using Invoke-MgGraphRequest and it seems to do the same thing. This is the response from one of them.

I've checked and it shouldn't of added two of the same event but when I check Jake's calendar it shows like this:

@.***

Creating a new calendar event for University Study Attendance on 2024-09-11T00:00:00... Key : id Value : AAMkAGNmNzJiZmIxLWNmYzctNDg0Ni04ZWFlLWE3M2I3ODA4ZGFhZABGAAAAAADmDufLA-26TLf7b6JGGdIaBwAhLM5YdhxWQb8LVP-FZHH0AAAAAAENAAAhLM5YdhxWQb8LVP-FZHH0AADE1dhwAAA= Name : id

Key : body Value : {content, contentType} Name : body

Key : onlineMeetingProvider Value : unknown Name : onlineMeetingProvider

Key : isCancelled Value : False Name : isCancelled

Key : occurrenceId Value : Name : occurrenceId

Key : iCalUId Value : 040000008200E00074C5B7101A82E00800000000C3A4945E8A0EDB0100000000000000001000000011ADE55DFF95554DAE64F694889977B0 Name : iCalUId

Key : responseStatus Value : {time, response} Name : responseStatus

Key : importance Value : normal Name : importance

Key : webLink Value : https://outlook.office365.com/owa/?itemid=AAMkAGNmNzJiZmIxLWNmYzctNDg0Ni04ZWFlLWE3M2I3ODA4ZGFhZABGAAAAAADmDufLA%2F26TLf7b6JGGdIaBwAhLM5YdhxWQb8LVP%2FFZHH0AAAAAAENAAAhLM5YdhxWQb8LVP%2FFZHH0AADE1dhwAAA%3D&exvsurl=1&path=/calendar/item Name : webLink

Key : recurrence Value : Name : recurrence

Key : seriesMasterId Value : Name : seriesMasterId

Key : responseRequested Value : True Name : responseRequested

Key : originalStartTimeZone Value : Pacific Standard Time Name : originalStartTimeZone

Key : isReminderOn Value : True Name : isReminderOn

Key : uid Value : 040000008200E00074C5B7101A82E00800000000C3A4945E8A0EDB0100000000000000001000000011ADE55DFF95554DAE64F694889977B0 Name : uid

Key : isDraft Value : False Name : isDraft

Key : @odata.context Value : https://graph.microsoft.com/v1.0/$metadata#users('43981771-4612-4b5f-a0d0-b35eb4f7c632')/calendars('AAMkAGNmNzJiZmIxLWNmYzctNDg0Ni04ZWFlLWE3M2I3ODA4ZGFhZABGAAAAAADmDufLA-26TLf7b6JGGdIaBwAhLM5YdhxWQb8LVP-FZHH0AAAAAAEGAAAhLM5YdhxWQb8LVP-FZHH0AAAAs_3uAAA%3D')/events/$entity Name : @odata.context

Key : @odata.etag Value : W/"ISzOWHYcVkG/C1T/xWRx9AAAxG5aHw==" Name : @odata.etag

Key : categories Value : {} Name : categories

Key : createdDateTime Value : 24/09/2024 14:02:19 Name : createdDateTime

Key : isAllDay Value : True Name : isAllDay

Key : isOnlineMeeting Value : False Name : isOnlineMeeting

Key : locations Value : {} Name : locations

Key : attendees Value : {} Name : attendees

Key : allowNewTimeProposals Value : True Name : allowNewTimeProposals

Key : isOrganizer Value : True Name : isOrganizer

Key : organizer Value : {emailAddress} Name : organizer

Key : changeKey Value : ISzOWHYcVkG/C1T/xWRx9AAAxG5aHw== Name : changeKey

Key : hideAttendees Value : False Name : hideAttendees

Key : location Value : {uniqueIdType, coordinates, address, displayName...} Name : location

Key : onlineMeetingUrl Value : Name : onlineMeetingUrl

Key : start Value : {timeZone, dateTime} Name : start

Key : end Value : {timeZone, dateTime} Name : end

Key : hasAttachments Value : False Name : hasAttachments

Key : sensitivity Value : normal Name : sensitivity

Key : lastModifiedDateTime Value : 24/09/2024 14:02:19 Name : lastModifiedDateTime

Key : showAs Value : oof Name : showAs

Key : transactionId Value : Name : transactionId

Key : onlineMeeting Value : Name : onlineMeeting

Key : type Value : singleInstance Name : type

Key : reminderMinutesBeforeStart Value : 15 Name : reminderMinutesBeforeStart

Key : subject Value : University Study Attendance Name : subject

Key : bodyPreview Value : Synced from Rapport. Name : bodyPreview

Key : originalEndTimeZone Value : Pacific Standard Time Name : originalEndTimeZone

ID : 811 email : @.*** StartDate : 2024-09-18T00:00:00 EndDate : 2024-09-19T00:00:00 Type : University Study Attendance Duration : Full Day Approved : True

Regards

Thomas Wells (he/him) +44 191 269 5454

From: Tim @.> Sent: 24 September 2024 13:28 To: microsoftgraph/msgraph-sdk-powershell @.> Cc: Thomas Wells @.>; Mention @.> Subject: Re: [microsoftgraph/msgraph-sdk-powershell] New-MgUserCalendarEvent creating duplicate entries (Issue #2960)

You don't often get email from @.**@.>. Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

Caution: This is an external email

@TWells94https://github.com/TWells94 thank you for logging this issue. Please use Invoke-MgGraphRequest cmdlet and let us know if you are still having the same experience. Please use the sample request below. Maybe there is something causing a duplicate web request.

$params = @{

    subject = "Let's go for lunch"

    body = @{

           contentType = "HTML"

           content = "Does mid month work for you?"

    }

    start = @{

           dateTime = "2019-03-15T12:00:00"

           timeZone = "Pacific Standard Time"

    }

    end = @{

           dateTime = "2019-03-15T14:00:00"

           timeZone = "Pacific Standard Time"

    }

    location = @{

           displayName = "Harry's Bar"

    }

    attendees = @(

           @{

                   emailAddress = @{

                           address = ***@***.******@***.***>"

                           name = "Adele Vance"

                   }

                   type = "required"

           }

    )

    transactionId = "7E163156-7762-4BEB-A1C6-729EA81755A7"

}

Invoke-mggraphrequest -Uri 'https://graph.microsoft.com/v1.0/users//calendars//events' -Method POST -Body $Params -debug

- Reply to this email directly, view it on GitHubhttps://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2960#issuecomment-2371131197, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BHXJTOSEQUB4O45LL4Y5DZLZYFLD5AVCNFSM6AAAAABOOC5LTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZRGEZTCMJZG4. You are receiving this because you were mentioned.Message ID: @.**@.>>

TWells94 commented 1 month ago

Apologies the screenshot sent was the 18th which did do the same thing.

@.***

Regards

Thomas Wells (he/him) +44 191 269 5454

From: Thomas Wells @.> Sent: 24 September 2024 15:07 To: microsoftgraph/msgraph-sdk-powershell @.>; microsoftgraph/msgraph-sdk-powershell @.> Cc: Mention @.> Subject: RE: [microsoftgraph/msgraph-sdk-powershell] New-MgUserCalendarEvent creating duplicate entries (Issue #2960)

Hi Tim,

I've tested using Invoke-MgGraphRequest and it seems to do the same thing. This is the response from one of them.

I've checked and it shouldn't of added two of the same event but when I check Jake's calendar it shows like this:

@.***

Creating a new calendar event for University Study Attendance on 2024-09-11T00:00:00... Key : id Value : AAMkAGNmNzJiZmIxLWNmYzctNDg0Ni04ZWFlLWE3M2I3ODA4ZGFhZABGAAAAAADmDufLA-26TLf7b6JGGdIaBwAhLM5YdhxWQb8LVP-FZHH0AAAAAAENAAAhLM5YdhxWQb8LVP-FZHH0AADE1dhwAAA= Name : id

Key : body Value : {content, contentType} Name : body

Key : onlineMeetingProvider Value : unknown Name : onlineMeetingProvider

Key : isCancelled Value : False Name : isCancelled

Key : occurrenceId Value : Name : occurrenceId

Key : iCalUId Value : 040000008200E00074C5B7101A82E00800000000C3A4945E8A0EDB0100000000000000001000000011ADE55DFF95554DAE64F694889977B0 Name : iCalUId

Key : responseStatus Value : {time, response} Name : responseStatus

Key : importance Value : normal Name : importance

Key : webLink Value : https://outlook.office365.com/owa/?itemid=AAMkAGNmNzJiZmIxLWNmYzctNDg0Ni04ZWFlLWE3M2I3ODA4ZGFhZABGAAAAAADmDufLA%2F26TLf7b6JGGdIaBwAhLM5YdhxWQb8LVP%2FFZHH0AAAAAAENAAAhLM5YdhxWQb8LVP%2FFZHH0AADE1dhwAAA%3D&exvsurl=1&path=/calendar/item Name : webLink

Key : recurrence Value : Name : recurrence

Key : seriesMasterId Value : Name : seriesMasterId

Key : responseRequested Value : True Name : responseRequested

Key : originalStartTimeZone Value : Pacific Standard Time Name : originalStartTimeZone

Key : isReminderOn Value : True Name : isReminderOn

Key : uid Value : 040000008200E00074C5B7101A82E00800000000C3A4945E8A0EDB0100000000000000001000000011ADE55DFF95554DAE64F694889977B0 Name : uid

Key : isDraft Value : False Name : isDraft

Key : @odata.context Value : https://graph.microsoft.com/v1.0/$metadata#users('43981771-4612-4b5f-a0d0-b35eb4f7c632')/calendars('AAMkAGNmNzJiZmIxLWNmYzctNDg0Ni04ZWFlLWE3M2I3ODA4ZGFhZABGAAAAAADmDufLA-26TLf7b6JGGdIaBwAhLM5YdhxWQb8LVP-FZHH0AAAAAAEGAAAhLM5YdhxWQb8LVP-FZHH0AAAAs_3uAAA%3D')/events/$entity Name : @odata.context

Key : @odata.etag Value : W/"ISzOWHYcVkG/C1T/xWRx9AAAxG5aHw==" Name : @odata.etag

Key : categories Value : {} Name : categories

Key : createdDateTime Value : 24/09/2024 14:02:19 Name : createdDateTime

Key : isAllDay Value : True Name : isAllDay

Key : isOnlineMeeting Value : False Name : isOnlineMeeting

Key : locations Value : {} Name : locations

Key : attendees Value : {} Name : attendees

Key : allowNewTimeProposals Value : True Name : allowNewTimeProposals

Key : isOrganizer Value : True Name : isOrganizer

Key : organizer Value : {emailAddress} Name : organizer

Key : changeKey Value : ISzOWHYcVkG/C1T/xWRx9AAAxG5aHw== Name : changeKey

Key : hideAttendees Value : False Name : hideAttendees

Key : location Value : {uniqueIdType, coordinates, address, displayName...} Name : location

Key : onlineMeetingUrl Value : Name : onlineMeetingUrl

Key : start Value : {timeZone, dateTime} Name : start

Key : end Value : {timeZone, dateTime} Name : end

Key : hasAttachments Value : False Name : hasAttachments

Key : sensitivity Value : normal Name : sensitivity

Key : lastModifiedDateTime Value : 24/09/2024 14:02:19 Name : lastModifiedDateTime

Key : showAs Value : oof Name : showAs

Key : transactionId Value : Name : transactionId

Key : onlineMeeting Value : Name : onlineMeeting

Key : type Value : singleInstance Name : type

Key : reminderMinutesBeforeStart Value : 15 Name : reminderMinutesBeforeStart

Key : subject Value : University Study Attendance Name : subject

Key : bodyPreview Value : Synced from Rapport. Name : bodyPreview

Key : originalEndTimeZone Value : Pacific Standard Time Name : originalEndTimeZone

ID : 811 email : @.**@.> StartDate : 2024-09-18T00:00:00 EndDate : 2024-09-19T00:00:00 Type : University Study Attendance Duration : Full Day Approved : True

Regards

Thomas Wells (he/him) +44 191 269 5454

From: Tim @.**@.>> Sent: 24 September 2024 13:28 To: microsoftgraph/msgraph-sdk-powershell @.**@.>> Cc: Thomas Wells @.**@.>>; Mention @.**@.>> Subject: Re: [microsoftgraph/msgraph-sdk-powershell] New-MgUserCalendarEvent creating duplicate entries (Issue #2960)

You don't often get email from @.**@.>. Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

Caution: This is an external email

@TWells94https://github.com/TWells94 thank you for logging this issue. Please use Invoke-MgGraphRequest cmdlet and let us know if you are still having the same experience. Please use the sample request below. Maybe there is something causing a duplicate web request.

$params = @{

    subject = "Let's go for lunch"

    body = @{

           contentType = "HTML"

           content = "Does mid month work for you?"

    }

    start = @{

           dateTime = "2019-03-15T12:00:00"

           timeZone = "Pacific Standard Time"

    }

    end = @{

           dateTime = "2019-03-15T14:00:00"

           timeZone = "Pacific Standard Time"

    }

    location = @{

           displayName = "Harry's Bar"

    }

    attendees = @(

           @{

                   emailAddress = @{

                           address = ***@***.******@***.***>"

                           name = "Adele Vance"

                   }

                   type = "required"

           }

    )

    transactionId = "7E163156-7762-4BEB-A1C6-729EA81755A7"

}

Invoke-mggraphrequest -Uri 'https://graph.microsoft.com/v1.0/users//calendars//events' -Method POST -Body $Params -debug

- Reply to this email directly, view it on GitHubhttps://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2960#issuecomment-2371131197, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BHXJTOSEQUB4O45LL4Y5DZLZYFLD5AVCNFSM6AAAAABOOC5LTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZRGEZTCMJZG4. You are receiving this because you were mentioned.Message ID: @.**@.>>

timayabi2020 commented 1 month ago

@TWells94 is it possible to switch to a different network environment and execute the request?

TWells94 commented 1 month ago

Hi Tim.

I've tried it on my personal PC but it seems to do the same thing.


From: Tim @.> Sent: Thursday, September 26, 2024 6:14:56 PM To: microsoftgraph/msgraph-sdk-powershell @.> Cc: Thomas Wells @.>; Mention @.> Subject: Re: [microsoftgraph/msgraph-sdk-powershell] New-MgUserCalendarEvent creating duplicate entries (Issue #2960)

You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

Caution: This is an external email

@TWells94https://github.com/TWells94 is it possible to switch to a different network environment and execute the request?

- Reply to this email directly, view it on GitHubhttps://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2960#issuecomment-2377508884, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BHXJTOXBYMCR4DQZ32X2BMTZYQ6JBAVCNFSM6AAAAABOOC5LTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZXGUYDQOBYGQ. You are receiving this because you were mentioned.Message ID: @.***>

TWells94 commented 1 month ago

Additionally, i checked a previous script i created a while ago and it seems to be duplicating them aswell.

I've just tried troubleshooting with only putting one calendar event in and it still duplicated it. However the first time it did only put one event in after removing it and then restarting the script with a new powershell window. It duplicated it on the 2nd time so i think the behaviour is random.

timayabi2020 commented 1 month ago

Hi @TWells94 apologies for that experience. At this point, this now seems to be a service issue and unfortunately for API related issues/questions we are not best placed to give an answer. Kindly raise an issue here https://developer.microsoft.com/en-us/graph/support so that the API owner can respond to it.

TWells94 commented 1 month ago

Hi Tim,

I originally went to the admin portal and submitted a ticket that way but they passed me to yourselves.

Regards

Thomas Wells (he/him) +44 191 269 5454

From: Tim @.> Sent: 03 October 2024 13:19 To: microsoftgraph/msgraph-sdk-powershell @.> Cc: Thomas Wells @.>; Mention @.> Subject: Re: [microsoftgraph/msgraph-sdk-powershell] New-MgUserCalendarEvent creating duplicate entries (Issue #2960)

Caution: This is an external email

Hi @TWells94https://github.com/TWells94 apologies for that experience. At this point, this now seems to be a service issue and unfortunately for API related issues/questions we are not best placed to give an answer. Kindly raise an issue here https://developer.microsoft.com/en-us/graph/support so that the API owner can respond to it.

- Reply to this email directly, view it on GitHubhttps://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2960#issuecomment-2391276486, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BHXJTOSGBYCWJXN35RAGXBTZZUY2TAVCNFSM6AAAAABOOC5LTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJRGI3TMNBYGY. You are receiving this because you were mentioned.Message ID: @.**@.>>

timayabi2020 commented 1 month ago

Hi @TWells94 Apologies for the delay. kindly try and use this tool (https://developer.microsoft.com/en-us/graph/graph-explorer) and let me know if you are still experiencing the same issue.

microsoft-github-policy-service[bot] commented 3 weeks ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.