Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB.net Send Outlook Invite

Posted on 2014-02-05
4
Medium Priority
?
973 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 28

Accepted Solution

by:
MacroShadow earned 2000 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 28

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

824 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