Link to home
Start Free TrialLog in
Avatar of Len Kally
Len KallyFlag for United States of America

asked on

Recurring calendar event

I am trying to delete a calendar event that shows up in users calendar as unreadable.
I get into his calendar via OWA, I try deleting it and it will not work.

How can I delete this single calendar event via powershell.
Can I delete by subject line.

I have trouble deleting it in OWA, so I want to use Powershell.
thanks
User generated image
Avatar of Nadav Solomon
Nadav Solomon

Make sure the subject you insert is unique
$subject = "test123"
#####################################################################
Add-type -assembly "Microsoft.Office.Interop.Outlook" | out-null
$olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
$outlook = new-object -comobject outlook.application
$namespace = $outlook.GetNameSpace("MAPI")
$folder = $namespace.getDefaultFolder($olFolders::olFolderCalendar)
$filter = "[SUBJECT] = '$subject'"
$folderItems = $folder.items
$folderItems.IncludeRecurrences = $true
$folderItems = $folderItems.Restrict($filter)
$folderItems | %{
    $_.subject
    $_.delete()
}  

Open in new window

Avatar of Len Kally

ASKER

Question, this is for a particular user,  I do not see where that is specified in the script.
I do not want it for ALL of exchange,  I need a recurring calendar event removed for a particular user.

thanks
This script works on the clients outlook not on the exchange, the user that is configured in the outlook is the one effected.
Explain  you is this script run on the clients desktop?

I am looking for a line command that will do it at the exchange side if this can be done.

thanks
ASKER CERTIFIED SOLUTION
Avatar of Nadav Solomon
Nadav Solomon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glad I could help, thanks for the feedback.
No thanks for your help, it was very helpful.