Solved

VB.net Send Outlook Invite

Posted on 2014-02-05
4
846 Views
Last Modified: 2014-02-05
Hi,

How to send meeting invite using VB.Net?

Thanks,

Sanjay.
0
Comment
Question by:sanjay-gandhi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39835288
How about this from Microsoft:
Imports System.Reflection

Module Module1

    Sub Main()
       ' Create an Outlook application.
        Dim oApp As Outlook.Application = New Outlook.Application()

        ' Get Mapi NameSpace and Logon.
        Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
        oNS.Logon("YourValidProfile", Missing.Value, False, True) ' TODO:
        
        ' Create an AppointmentItem.
        Dim oAppt As Outlook._AppointmentItem = oApp.CreateItem(Outlook.OlItemType.olAppointmentItem)
        'oAppt.Display(true)  'Modal	

        ' Change AppointmentItem to a Meeting. 
        oAppt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting

        ' Set some common properties.
        oAppt.Subject = "Created using OOM in VB.NET"
        oAppt.Body = "Hello World"
        oAppt.Location = "Samm E"

        oAppt.Start = Convert.ToDateTime("11/30/2001 9:00:00 AM")
        oAppt.End = Convert.ToDateTime("11/30/2001 1:00:00 PM")

        oAppt.ReminderSet = True
        oAppt.ReminderMinutesBeforeStart = 5
        oAppt.BusyStatus = Outlook.OlBusyStatus.olBusy  '  olBusy
        oAppt.IsOnlineMeeting = False
        oAppt.AllDayEvent = False

        ' Add attendees.
        Dim oRecipts As Outlook.Recipients = oAppt.Recipients

        ' Add required attendee.
        Dim oRecipt As Outlook.Recipient
        oRecipt = oRecipts.Add("UserTest1") ' TODO:
        oRecipt.Type = Outlook.OlMeetingRecipientType.olRequired

        ' Add optional attendee.
        oRecipt = oRecipts.Add("UserTest2") ' TODO:
        oRecipt.Type = Outlook.OlMeetingRecipientType.olOptional

        oRecipts.ResolveAll()

        'oAppt.Display(true)

        ' Send out request.
        oAppt.Send()

        ' Logoff.
        oNS.Logoff()

    End Sub

End Module

Open in new window

http://support.microsoft.com/kb/313789
0
 

Author Comment

by:sanjay-gandhi
ID: 39836337
Does not work. Either Outlook.Application gives error or only Application gives error. I had downloaded similar code from Net, but that too gave similar errors. I have also included the namespaces mentioned on Microsoft link, but sorry, no gains.

Sanjay.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39836503
That is weird, if you followed these steps that were mentioned in the aforementioned Microsoft How-To you should not be running into an error. Just to make sure, is this what you did:
    1. On the Project menu, click Add Reference.
    2. On the COM tab, click Microsoft Outlook XX.X Object Library, and then click Select.
    3. In the Add References dialog box, click OK to accept your selections. If you are prompted to generate wrappers for the libraries that you selected, click Yes.
0
 

Author Closing Comment

by:sanjay-gandhi
ID: 39837850
Yes, I followed these steps. But it did not ask to generate any wrappers.

But on retry, it asked me to add Imports Microsoft.Office.Interop, and one more namespace.

It has finally worked with the above namespace.

Plus how do I ask the attendee to give accept or reject.

Thanks.
Sanjay.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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