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
- Convert RTF Messages to Plain Text Format
- Create a rule to delete mail after a number of days
- How to Change the Font used for Outlook's RSS Feeds
- Keep Canceled Meetings on Outlook's Calendar
- Move messages CC'd to an address
- 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
- 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
- Sort messages by Sender domain
- Use a Rule to delete older messages as new ones arrive
- Use a run a script rule to mark messages read
- Use VBA to move messages with attachments