Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2006-03-20
3
Medium Priority
?
1,612 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.
0
Comment
Question by:DCreature
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
DotNetLover_Baan earned 1500 total points
ID: 16246187
0
 
LVL 6

Author Comment

by:DCreature
ID: 16297930
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.
0
 
LVL 6

Author Comment

by:DCreature
ID: 16297941
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);

********************************************
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

578 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