Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to put appointments name and date and then it will delete from outlook
Anybody knows code for c# WPF please help me I couldn't find because I use code from Microsoft but I got some error please help me....

I found this code
Outlook.MAPIFolder calendar =
    Application.Session.GetDefaultFolder(
     Outlook.OlDefaultFolders.olFolderCalendar);

Outlook.Items calendarItems = calendar.Items;

Outlook.AppointmentItem item =
    calendarItems["Test Appointment"] as Outlook.AppointmentItem;

Outlook.RecurrencePattern pattern =
    item.GetRecurrencePattern();
Outlook.AppointmentItem itemDelete = pattern.
    GetOccurrence(new DateTime(2006, 6, 28, 8, 0, 0));

if (itemDelete != null)
{
    itemDelete.Delete();
}


What I have tried:

I try everything but nothing worked
Outlook.MAPIFolder calendar =
              Application.Session.GetDefaultFolder(
               Outlook.OlDefaultFolders.olFolderCalendar);

          Outlook.Items calendarItems = calendar.Items;

cleander and session giver error what can I d do for it
Posted
Updated 5-Nov-17 21:48pm
v2
Comments
Graeme_Grant 6-Nov-17 2:52am    
This is not a WPF question. This is a .Net question. You can read more about working with Outlook here: c# working with outlook - Google Search[^]. Also: c# outlook appiontment creation - Google Search[^]
---
UPDATE: Now that you have found code and tried to use it, it is time to set a breakpoint, step through the code, and learn what it does BEFORE trying to change it.

1 solution

Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

A very quick search gave 83,000 hits: delete outlook appointments c - Google Search[^]

And MSDN has the solution: AppointmentItem Methods (Microsoft.Office.Interop.Outlook)[^]
_AppointmentItem.Delete Method (Microsoft.Office.Interop.Outlook)[^]
 
Share this answer
 
Comments
ANIL AYDINALP 6-Nov-17 8:06am    
I know it if you don't know soluction do not answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900