Forum Discussion

kirboronin's avatar
kirboronin
Copper Contributor
Nov 13, 2019
Solved

Remove-CalendarEvents cmdlet does not work

I used that several times and had a cheat-sheet with commands to clean recurring meetings of persons who has left the company.

 

That did not work the last time, returning error:

 

Remove-CalendarEvents -Identity name.lastname@company.com -CancelOrganizedMeetings -PreviewOnly

Microsoft.Exchange.Entities.DataModel.InvalidRequestException: Your request can't be completed. The range between the start and end dates is greater than the allowed range. Maximum
number of days: 1825

 

When I tried to specify time period, I got this:

 

Remove-CalendarEvents -Identity name.lastname@company.com -CancelOrganizedMeetings -QueryStartDate 4-11-2019 -PreviewOnly

System.Management.Automation.ParentContainsErrorRecordException: Cannot process argument transformation on parameter 'QueryStartDate'. Cannot convert value "11.4.2019 0.00.00" to t
ype "Microsoft.Exchange.ExchangeSystem.ExDateTime". Error: "String was not recognized as a valid DateTime.". 

 

 

Again, that was working couple months ago just fine.

  • kirboronin 

    I had the exact same problem.

    Then i noticed the error message always translating whatever timedate-string I attempted to use to my locale.

    The error was introduced by some Microsoft Engineer unable to take into account the existence of other languages but US-English.

    Try setting your region settings in the OS to US English. Then start a new powershell. Connect to Office 365. Issue the command.

8 Replies

  • LarsLyngby's avatar
    LarsLyngby
    Copper Contributor

    kirboronin 

    I had the exact same problem.

    Then i noticed the error message always translating whatever timedate-string I attempted to use to my locale.

    The error was introduced by some Microsoft Engineer unable to take into account the existence of other languages but US-English.

    Try setting your region settings in the OS to US English. Then start a new powershell. Connect to Office 365. Issue the command.

    • kirboronin's avatar
      kirboronin
      Copper Contributor
      Thanks! But I solve it just by adding -QueryWindowInDays 1825
      We have limit of 365 days for booking meeting rooms, so I hope, 5 years is enough.
    • LarsLyngby's avatar
      LarsLyngby
      Copper Contributor
      (Just added the solution to the reddit thread - WhatAWorld65)
  • Ricardo Viana's avatar
    Ricardo Viana
    Steel Contributor
    I'm not sure, but maybe it's related with date format. It should be mm/dd/yyyy (not with '-')
    • kirboronin's avatar
      kirboronin
      Copper Contributor

      Ricardo Viana yes, I thought about that weird us format too, but there is no difference between 4 Nov and 11 April, right?

      Tried different dividers: ,./- with same error message: "Cannot convert value "11.4.2019 0.00.00"

       

      VasilMichev that format "4 Nov 2019" returns completely the same error: "Cannot convert value "4.11.2019 0.00.00"

       

      The problem is: that was warking even without -QueryStartDate parameter. And I can't find anything in MS documentation about any changes.

      • Ricardo Viana's avatar
        Ricardo Viana
        Steel Contributor

        It looks like you now need QueryStartDate and QueryWindowInDays (max value 1825). As you mentioned there is no documentation about this change and the Remove-CalendarEvents is not updated as well.

        Ran it like this and it worked:
        Remove-CalendarEvents -Identity user@domain.com -QueryStartDate 11/04/2018 -QueryWindowInDays 1825 -CancelOrganizedMeetings -PreviewOnly