VB.Net application to add an appointment to Outlook 2003.

Posted on 2006-03-20
Last Modified: 2008-01-09
I have written a VB.Net application to add specified numbers of Days, Hours, and Minutes to current system date / time then display a result on a label as calculated date and time.

I want to have a new option which will allow a user to type some text into fields (subject / content of the appointment) then click a button "Add to Outlook" (Can this be any versions and not just 2003? If not then 2003 is fine) to add the currently displayed date and time to Outlook 2003 together with appointment's title and content text.
Question by:DCreature
    LVL 18

    Accepted Solution

    LVL 6

    Author Comment

    Thanks DotNetLover_Baan, however I would appreciate us all making Experts-Exchange a great place for source of knowledge and not just a web site that indexes bunches of links to other sites, which in the future, may or may not exist.

    LVL 6

    Author Comment

    Having said that, here is the content found on some of those links:

    (These information are from

    Description: You can use the Namespace.GetSharedDefaultFolder method to access the Calendar folder in another Exchange mailbox. Keep in mind that you might not have permission to even see that folder, or you might have only read access.

    Sub CreateOtherUserAppointment()
        Dim objApp As Outlook.Application
        Dim objNS As Outlook.NameSpace
        Dim objFolder As Outlook.MAPIFolder
        Dim objDummy As Outlook.MailItem
        Dim objRecip As Outlook.Recipient
        Dim objAppt As Outlook.AppointmentItem
        Dim strMsg As String
        Dim strName As String
        On Error Resume Next
        ' ### name of person whose Calendar you want to use ###
        strName = "FlaviusJ"
        Set objApp = CreateObject("Outlook.Application")
        Set objNS = objApp.GetNamespace("MAPI")
        Set objDummy = objApp.CreateItem(olMailItem)
        Set objRecip = objDummy.Recipients.Add(strName)
        If objRecip.Resolved Then
            On Error Resume Next
            Set objFolder = _
              objNS.GetSharedDefaultFolder(objRecip, _
            If Not objFolder Is Nothing Then
                Set objAppt = objFolder.Items.Add
                If Not objAppt Is Nothing Then
                    With objAppt
                        .Subject = "Test Appointment"
                        .Start = Date + 14
                        .AllDayEvent = True
                    End With
                End If
            End If
            MsgBox "Could not find " & Chr(34) & strName & Chr(34), , _
                   "User not found"
        End If

        Set objApp = Nothing
        Set objNS = Nothing
        Set objFolder = Nothing
        Set objDummy = Nothing
        Set objRecip = Nothing
        Set objAppt = Nothing
    End Sub


    Content of another link:

    Code level: intermediate    Code area: Outlook and .NET
    Title: Outlook & mapi
    Description: this C# code uses OOM and mapi to create an appointment in the current outlook profile

    Outlook.Application oApp = new Outlook.ApplicationClass();
    Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
    oNS.Logon("profileName", "Password", false, true);

    Outlook.AppointmentItem oAppt = (Outlook.AppointmentItem)oApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
    oAppt.Subject = "Created using OOM in C#";
    oAppt.Body = "Hello World";
    oAppt.Location = "Samm E";
    oAppt.Start = Convert.ToDateTime("03/08/2004 9:00:00 AM");
    oAppt.End = Convert.ToDateTime("03/08/2004 1:00:00 PM");
    oAppt.ReminderSet = true;
    oAppt.ReminderMinutesBeforeStart = 5;
    oAppt.BusyStatus = Outlook.OlBusyStatus.olBusy;
    oAppt.IsOnlineMeeting = false;


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now