Forward Appointment as BCC with VBScript

Outlook version
Outlook 2016 32 bit
Email Account
IMAP
#1
Hi,

i am pretty new with VBA and I have the following requirement.

I want to forward every incoming appointment to a BCC receiver.

I just used this example which sends every appointment to an email receiver - but not with BCC:

<----------->
Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Dim Folder As Outlook.MAPIFolder

Set Ns = Application.GetNamespace("MAPI")
Set Folder = Ns.GetDefaultFolder(olFolderCalendar)
Set Items = Folder.Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
Dim Appt As Outlook.AppointmentItem

If TypeOf Item Is Outlook.AppointmentItem Then
Set Appt = Item
Appt.Recipients.Add "xxxx@yyyyyy.zz"
Appt.MeetingStatus = olMeeting
Appt.Save
Appt.Send
End If

End Sub
<----------->

Is there a way to modify the above coding in a way that the appointment will be send with blind copy (BCC)?

Many thanks in advance
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#2
Outlook version
Outlook 2016 32 bit
Email Account
IMAP
#3
many thanks for your fast reply Diana :)

Is this sequence ok?

If TypeOf Item Is Outlook.AppointmentItem Then
Set Appt = Item
Appt.Recipients.Add "xxxx@yyyyyy.zz"
Appt.Recipients.Type = olBCC
Appt.MeetingStatus = olMeeting
Appt.Save
Appt.Send
End If


..or should it be the other way around?

If TypeOf Item Is Outlook.AppointmentItem Then
Set Appt = Item
Appt.Recipients.Type = olBCC
Appt.Recipients.Add "xxxx@yyyyyy.zz"
Appt.MeetingStatus = olMeeting
Appt.Save
Appt.Send
End If


I really appreciate your help!

Thanks
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#4
thisi s the correct order -
Code:
Appt.Recipients.Add "xxxx@yyyyyy.zz"
Appt.Recipients.Type = olBCC
 
Outlook version
Outlook 2016 32 bit
Email Account
IMAP
#6
Run-time error '438': Object doesn't support this property or method

Guess .Type is not available for Outlook.AppointmentItem
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#8
A small change does it. You cannot set the type for all recipients at once but have to do it for each single recipient.
Code:
dim r as recipient
set r=Appt.Recipients.Add ("xxxx@yyyyyy.zz")
r.Type = olBCC
 

Similar threads

Top