We help IT Professionals succeed at work.

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

DCreature
DCreature asked
on
Medium Priority
1,625 Views
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.
Comment
Watch Question

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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.

Thanks.

Author

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

(These information are from http://www.outlookcode.com).

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)
    objRecip.Resolve
    If objRecip.Resolved Then
        On Error Resume Next
        Set objFolder = _
          objNS.GetSharedDefaultFolder(objRecip, _
            olFolderCalendar)
        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
                    .Save
                End With
            End If
        End If
    Else
        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;
                  
oAppt.Save();
oAppt.Display(true);

********************************************
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.