从用户日历中删除会议

时间:2014-09-12 11:12:21

标签: powershell outlook exchange-server exchangewebservices

我们正在使用Exchange Server 2010.我可以使用search-mailbox cmdlet从用户邮箱中删除会议,如下所述

search-mailbox -searchquery "kind:meetings from:$recipient" -targetmailbox $mailid -targetfolder "REPORT" -deletecontent -force

我的问题是如何在从组织者邮箱中删除会议后向与会者发送取消邮件?

此致

Sankar M

2 个答案:

答案 0 :(得分:0)

你不能。 Search-mailbox是服务器端/管理功能。取消会议是客户端/用户功能。如果您想发送取消通知,则需要使用EWS进行正常的用户会议取消。

答案 1 :(得分:0)

这里是一个如何使用Outlook作为com对象从今天取消会议的示例。

    $outlookApplication = New-Object -ComObject 'Outlook.Application'
    $namespace  = $outlookApplication.GetNamespace("MAPI")
    print("Define Start/End time for filtering existing meetings..")
    $Start = (Get-Date).AddDays(-1).ToShortDateString() + " 11:59 PM"
    $End = (Get-Date).AddDays(+1).ToShortDateString() + " 12:01 AM"
    print("Start time: " + $Start)
    print("End time: " + $End)
    print("Create meeting filter..")
    $Filter = "[MessageClass]='IPM.Appointment' AND [Start] > '$Start' AND [End] < '$End'  
    AND     [IsRecurring] = '$False'"
    print("Extract all meetings...")
    $olFolderCalendar = 9
    $Appointments = $namespace.GetDefaultFolder($olFolderCalendar).Items
    $Appointments.Sort("[Start]")
    $Appointments.IncludeRecurrences = $false
    print("Process all meeting from today..")
    foreach ($Appointment in $Appointments.Restrict($Filter) ) {
        print("Process meeeting.. Subject: " + $Appointment.Subject)
        print("Required resources: " + $Appointment.Resources)
        print("Meeting start time: " + $Appointment.Start)
        print("Meeting end time: " + $Appointment.End)
        print("Cancell meeting..")
        $Appointment.meetingstatus = 5
        # olMeeting 1   The meeting has been scheduled.
        # olMeetingCanceled 5   The scheduled meeting has been cancelled.
        # olMeetingReceived 3   The meeting request has been received.
        # olMeetingReceivedAndCanceled  7   The scheduled meeting has been cancelled but 
         still appears on the user's calendar.
        # olNonMeeting  0   An Appointment item without attendees has been scheduled. This 
         status can be used to set up holidays on a calendar.
        $Appointment.Send()
        print("Delete meeting..")
        $Appointment.Delete()
    }