Solved

use VBA to send appointment or meeting request, but I don't want to attend

Posted on 2011-09-29
4
1,379 Views
Last Modified: 2012-05-12
I've got an Access VBA application that I want to create appointments from. I've used FreeBusy information to figure out when someone's available, now I need to send them an email notifying them that I've booked them. Plus I want to book the room at the same time.

This seems to work with the following VBA code. Except that I'm included in the meeting, and I don't want to be. So how can I do this?

I know how to scroll through a list of Mailboxes, find the right Mailbox, then add the Appointment Item to that folder (instead of my default Appointment folder). But I'd like to have a way of doing this without requiring everyone who uses the application to open every possible recipient's Mailbox.

Since I have 23 possible recipients + 6 meeting rooms, I thought maybe another way to do it would be to send the appointment request on behalf of the meeting room, then add the other person to the recipients list. That would only require having the 6 meeting rooms open from the user's Outlook. But still, I wonder if there's a way to do this without requiring that any of these other Mailboxes are open.

I thought there should be a way to remove me from the Recipients collection, but I'm not in the collection. Probably because it doesn't make logical sense to add something to my calendar, but then have me not attending.

Also, would any of this make any difference using a Meeting item instead of an Appointment item? The definition in the Outlook help I've seen about them is that a Meeting is an Appointment with a second person or a Room or Equipment, etc.

Any thoughts on this greatly appreciated.
Dim oApp As Outlook.Application
  Dim oAppt As Outlook.AppointmentItem
  Dim oRecipts As Outlook.Recipients
  Dim oRecipt As Outlook.Recipient

    Set oApp = CreateObject("Outlook.Application")
    Set oAppt = oApp.CreateItem(olAppointmentItem)
    With oAppt
        .MeetingStatus = Outlook.OlMeetingStatus.olMeeting
        .Subject = "Intake Appointment for " & Me.txtClientName
        If Not IsNull(Me.txtRoom) Then .Location = Me.txtRoom
        .Start = Me.txtDateTime
        .End = DateAdd("n", Me.txtMinutes, .Start)
        .ReminderMinutesBeforeStart = 5
        .ReminderSet = True
        .BusyStatus = Outlook.OlBusyStatus.olBusy
        .IsOnlineMeeting = False
        .AllDayEvent = False
        
        ' Add interviewer
        Set oRecipts = oAppt.Recipients
        Set oRecipt = oRecipts.Add(Me.txtInterviewer)
        oRecipt.Type = Outlook.OlMeetingRecipientType.olRequired
        .Display

Open in new window

0
Comment
Question by:GordonPrince
  • 4
4 Comments
 
LVL 4

Author Comment

by:GordonPrince
ID: 36815841
I found this
http://msdn.microsoft.com/en-us/library/ms875944(v=EXCHG.65).aspx 
that describes how to do it using CDO.

But since CDO is not supported in Outlook 2010, does anyone know of a way to do this without using CDO?
0
 
LVL 4

Accepted Solution

by:
GordonPrince earned 0 total points
ID: 36817490
Maybe I should just make a new Public Folder with Appointments in it and create the Appointment there. Then email additional recipients + a room to include them.
0
 
LVL 4

Author Comment

by:GordonPrince
ID: 36818122
This looks promising:

'This Visual Basic for Applications (VBA) example uses the GetSharedDefaultFolder method to resolve the Recipient object representing Dan Wilson, and then returns Dan's shared default Calendar folder.
Sub ResolveName()
	Dim myOlApp As Outlook.Application
	Dim myNamespace As Outlook.NameSpace
	Dim myRecipient As Outlook.Recipient
	Dim CalendarFolder As Outlook.MAPIFolder
	Set myOlApp = CreateObject("Outlook.Application")
	Set myNamespace = myOlApp.GetNamespace("MAPI")
	Set myRecipient = myNamespace.CreateRecipient("Dan Wilson")
	myRecipient.Resolve
	If myRecipient.Resolved Then
		Call ShowCalendar(myNamespace, myRecipient)
	End If
End Sub

Sub ShowCalendar(myNamespace, myRecipient)
	Dim CalendarFolder As Outlook.MAPIFolder
	Set CalendarFolder = _
        myNamespace.GetSharedDefaultFolder _
        (myRecipient, olFolderCalendar)
	CalendarFolder.Display
End Sub

Open in new window

0
 
LVL 4

Author Closing Comment

by:GordonPrince
ID: 36915987
no experts commented, one of my ideas turned out to be workable
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Outlook Free & Paid Tools
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

867 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

15 Experts available now in Live!

Get 1:1 Help Now