locked
Deleting a calendar appointment? RRS feed

  • Question

  • User1725873861 posted

    Hi all,

    Ok, so the code below (in VB.NET - wanted C#.NET instead but what can you do?) automatically creates a meeting appointment in Outlook Calendar. It does exactly what I want. My next question is how do I delete an appointment in Outlook Calendar? Searched the net and cant find a result.

     

    Imports System.Reflection
    
    Module Module1
    
        Sub Main()
            ' Create an Outlook application.
            Dim oApp As Outlook.Application = New Outlook.Application()
    
            ' Get NameSpace and Logon.
            Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
            oNS.Logon(USERNAME, PASSWORD, False, True) ' TODO:
    
            ' Create a new AppointmentItem.
            Dim oAppt As Outlook.AppointmentItem = oApp.CreateItem(Outlook.OlItemType.olAppointmentItem)
            'oAppt.Display(true)  'Modal	
    
            ' Set some common properties.
            oAppt.Subject = "Created using OOM in C#"
            oAppt.Body = "Hello World"
            oAppt.Location = "Samm E"
    
            oAppt.Start = Convert.ToDateTime("10/10/2008 9:00:00 AM")
            oAppt.End = Convert.ToDateTime("10/10/2008 1:00:00 PM")
    
            oAppt.ReminderSet = True
            oAppt.ReminderMinutesBeforeStart = 5
            oAppt.BusyStatus = Outlook.OlBusyStatus.olBusy  '  olBusy
            oAppt.IsOnlineMeeting = False
    
            ' Save to Calendar.
            oAppt.Save()
    
            ' Display.
            'oAppt.Display(true)
    
            ' Logoff.
            oNS.Logoff()
    
            ' Clean up.
            oApp = Nothing
            oNS = Nothing
            oAppt = Nothing
        End Sub
    
    End Module
     
    Tuesday, July 8, 2008 3:40 AM

Answers

  • User1725873861 posted

    Ok, managed to find bits of code in classic ASP which is what I wanted. Put a few pages together to add, list and delete appointments so no worries, all sorted :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 11, 2008 7:33 AM

All replies

  • User1725873861 posted

    Ok, managed to find bits of code in classic ASP which is what I wanted. Put a few pages together to add, list and delete appointments so no worries, all sorted :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 11, 2008 7:33 AM
  • User1969660479 posted

    Hi Evil Angel, sorry If i am bothering you:) Was just wondering, I saw the email outlook appointment Application code that you have written in the asp.net website blog type of thing:). I wrote the same type of application but now I got this problem, I cannot create one that cancels the meeting appointment. I have changed the code to OLMeetingCanceled but What It does is if you send it, it makes an duplicate appointment item so in the calendar there will be 2 of the same appointments, and the email message got a remove from calendar button. If I click on the remove from calendar button It removes the newest one created by the cancelation email. and the original one does not get removed. Please if you have any Idea on how I am going to make that work let me know on my email address I will really appriciate it, and if there is anything you require dont hesitate to ask me because I will love to help you 2. my email address is : erhan.kula@bcx.co.za Thank you very much

    Thursday, July 17, 2008 4:16 AM
  • User1725873861 posted

    Got your mails and sent replies. Hope you came right? ;)

    Friday, July 18, 2008 10:31 AM
  • User1969660479 posted

    Hi Evil Angel I didnt get any of your mails, please send them again.

    erhan.kula@bcx.co.za

     

    Thank you...

    Monday, July 21, 2008 1:53 AM
  • User1725873861 posted

    LOL! Im the one thats been mailing you with the source code back and forth, the 3 files I sent in classic ASP? ;)

    For those looking for the solution, posted it on my blog: http://justsourcecode.wordpress.com

    ;)

    Monday, July 21, 2008 10:23 AM