In our article discussing BCCing messages, Michael wanted to BCC all incoming meeting requests and cancellations to another address. You can do this with a run a script rule. The macro at the bottom of the page is an ItemAdd macro and watches for new items to be added to the calendar, forwarding appointment details as well as meeting details to another address.
The Run a script version is built off of the AutoAcceptMeeting request code sample.
To use this macro, open the VBA Editor (Alt+F11) and paste the code into ThisOutlookSession.
Next you will need to create a rule that looks for meeting cancellation or meeting request forms then choose the Run a Script action.
The macro creates and sends a message containing appointment details. The message body will look like the following screenshot and can be edited to add or remove fields.
Sub ForwardMeetingDetails(oRequest As MeetingItem) Dim oAppt As AppointmentItem Set oAppt = oRequest.GetAssociatedAppointment(True) Dim fwdAppt As MailItem Set fwdAppt = Application.CreateItem(olMailItem) strBody = "Organizer: " & oAppt.Organizer & vbCrLf _ & "Start: " & oAppt.Start & vbCrLf & "End: " & oAppt.End _ & vbCrLf & "Location: " & oAppt.Location & vbCrLf & "Message: " & oAppt.Body With fwdAppt .Recipients.Add "email@example.com" .Subject = oAppt.Subject .Body = strBody .Send End With End Sub
Forward appointment details when an appointment is added to the calendar
With a few tweaks to the macro above, you can forward all appointments added to your calendar to another address.
This macro watches for new items to be added to the calendar and sends the details in a message.
It's an Application_Startup procedure and runs when Outlook starts. To test it without restarting Outlook, click in the Application_Startup macro and press Run (F5).
This macro needs to be in ThisOutlookSession.
Dim WithEvents newAppt As Items Private Sub Application_Startup() Dim NS As Outlook.NameSpace Set NS = Application.GetNamespace("MAPI") Set newAppt = NS.GetDefaultFolder(olFolderCalendar).Items Set NS = Nothing End Sub Private Sub newAppt_ItemAdd(ByVal Item As Object) Dim fwdAppt As MailItem Set fwdAppt = Application.CreateItem(olMailItem) Dim strBody As String strBody = "Organizer: " & Item.Organizer & vbCrLf _ & "Start: " & Item.Start & vbCrLf & "End: " & Item.End _ & vbCrLf & "Location: " & Item.Location & vbCrLf & "Message: " & Item.Body With fwdAppt .Recipients.Add "firstname.lastname@example.org" .Subject = Item.Subject .BodyFormat = olFormatPlain .Body = strBody 'Use Display to view onscreen and send yourself. Send will send it automatically ' .Display .Send End With End Sub
More Run a Script Samples:
- Autoaccept a Meeting Request using Rules
- Automatically Add a Category to Accepted Meetings
- Blocking Mail From New Top-Level Domains
- Convert RTF Messages to Plain Text Format
- Create a rule to delete mail after a number of days
- Create a Task from an Email using a Rule
- Create Appointment From Email Automatically
- Delegates, Meeting Requests, and Rules
- How to Change the Font used for Outlook's RSS Feeds
- How to Process Mail After Business Hours
- Keep Canceled Meetings on Outlook's Calendar
- Move messages CC'd to an address
- Open All Hyperlinks in an Outlook Email Message
- Outlook AutoReplies: One Script, Many Responses
- Outlook's Rules and Alerts: Run a Script
- Process messages received on a day of the week
- Read Outlook Messages using Plain Text
- Receive a Reminder When a Message Doesn't Arrive?
- Run a Script Rule: Change Subject then Forward Message
- Run a script rule: Reply to a message
- Run a Script Rule: Send a New Message when a Message Arrives
- Run Rules Now using a Macro
- Run-a-Script Rules Missing in Outlook
- Sort messages by Sender domain
- To create a rule with wildcards