PowerShell script to find meeting requests in Exchange mailbox and accept them

6,393

I'm a little late to the party; I imagine you're probably past this issue by now, but I just read this question today and thought it would be a fun exercise so here is the answer to your question. This bit of Powershell will log in to a Mailbox using the Outlook client, go through the Inbox and automatically accept any meeting invites. You can obviously tweak the code to be more to your liking (such as logging in to a different mailbox) but this would definitely get you started if you were still interested:

[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Outlook") | Out-Null
$Folders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -As [Type]
$Outlook = New-Object -ComObject Outlook.Application
$Namespace = $Outlook.GetNameSpace("MAPI")
$Inbox = $Namespace.getDefaultFolder($Folders::olFolderInbox)
ForEach ($_ In $Inbox.Items)
{
    If ($_.MessageClass -eq "IPM.Schedule.Meeting.Request") 
    {
        $AppointmentItem = $_.GetAssociatedAppointment($true)       
        $Response = $AppointmentItem.Respond(3,$True,$False)
        $Response.Send()
    }
}
Share:
6,393

Related videos on Youtube

Evan M.
Author by

Evan M.

Updated on September 18, 2022

Comments

  • Evan M.
    Evan M. over 1 year

    Is it possible to create a PowerShell script that will go into a mailbox (specifically for a meeting room), find all it's meeting requests and accept them?

    We've implemented a new mechanism in our exchange environment so that requests sent to meeting rooms will be auto-accepted if the room is available, but there are a lot of old requests (especially recurring meetings) that were sent before this change that are marked as tentative. This is a problem because when a new request is sent for a time that is marked as tentative, it will accept the request, which is leading to some conflicts.

    • Ben Pilbrow
      Ben Pilbrow over 12 years
      I'm not aware of any PowerShell cmdlets that do this, so you may be in EWS territory and have to write a program to do this.
  • Evan M.
    Evan M. over 12 years
    Writing a program up in .NET is an option, but what APIs would I be looking at?
  • Deb
    Deb over 12 years
    @EvanM For that, I wouldn't know. StackOverflow may be better for that.