Solved

VB.net Send Outlook Invite

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

How to send meeting invite using VB.Net?

Thanks,

Sanjay.
0
Comment
Question by:sanjay-gandhi
  • 2
  • 2
4 Comments
 
LVL 26

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 26

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

12 Experts available now in Live!

Get 1:1 Help Now