我有大量用户,他们的日历中每月都有一次会议,持续 10 年。我需要访问每个用户的日历,以确保该会议不再存在,或者如果存在,则显示谁拥有该会议,以便我可以进去并将其删除。我尝试使用 Get-MgUserEvent,但它只显示常见会议。
$startDate = "2024-04-03T00:00:00Z"
$endDate = "2024-04-05T23:59:59Z"
Get-MgUserEvent -UserId "[email protected]" -Filter "start/dateTime ge '$startDate' and start/dateTime le '$endDate'"
有什么帮助吗? :(
您应该使用 Get-MgUserCalendarView 而不是使用 Get-MgUserEvent,这将执行日历扩展,这意味着它将扩展您指定的时间段内的任何重复事件,而 Get-MgUserEvent 不执行扩展,因此将排除任何重复事件,并且返回主实例。例如
Get-MgUserCalendarView -UserId "[email protected]" -StartDateTime $startDate -EndDateTime $endDate
如果事件的主题是唯一的,那么仅对其进行过滤可能是更好的方法,因为您可以检查主实例并删除该实例,例如
Get-MgUserEvent -UserId "[email protected]" -Filter "Subject eq 'Meeting Subject'"