Forcing all new invitations to change me to a resource

S

sleepy

Hello,

I have an account that is dedicated to manage meeting rooms in our office. I
want to force all invitations to have this account marked as a resource
rather then an attendee.
Through further research I think I can do this by running a script on a rule
that applies after a message that is a meeting invite/update arrives, but I'm
having some difficulty. Would I have to remove the email address from the
attendees list and add it as a resource?
 
D

Dmitry Streblechenko

Yes, but that will only affect the local copy of the appointment. All other
attendees will see the old data.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
S

sleepy

I suppose that's ok, is there any other way that would update it on all?

As well, is this the correct code to do it:

Sub CustomMeetingRequestRule(Item As Outlook.MeetingItem)

If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then
Exit Sub

Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(True)
oAppt.Resources.Add = "pmgreception"
oAppt.RequiredAttendees.Remove "pmgreception"

End Sub
 
D

Dmitry Streblechenko

No, there is neither Resources not RequiredAttendees property.
Use the Recipients colleciton. The recipient type (Recipient.Type) will be
olTo for teh rquired attendees, olCC for the optional ones, and olBCC for
the resources.
Recipients.Remove method takes an integer index, not a string.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
S

sleepy

Hello Dmitry,

Thank you for your reply. This is what I have in there now. I have tried it
out but it just seems to drop out somewhere with no error. I get the first
message ("Beginning") so I know it's executing, but then no message after
that.

I also tried just updating the type of the existing recipient to olbcc, but
its read-only. Any suggestions?

Sub CustomMeetingRequestRule(Item As Outlook.MeetingItem)
MsgBox "Beginning"
If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then
MsgBox "about to exit"
Exit Sub
Else
Dim oRecAdd As Recipient
Dim oRecRem As Recipient
Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(True)
Set oRecRem = oAppt.Recipients.Item("(e-mail address removed)")
If Not IsNull(oRecRem) Then
oAppt.Recipients.Remove (oRecRem.Index)
End If
Set oRecAdd = oAppt.Recipients.Add("(e-mail address removed)")
oRecAdd.Type = olBCC

End If
MsgBox "its done"

End Sub
 
S

sleepy

Hello Dmitry,

I'm stuck, I'm not sure how to pass the index, do I just do a search on the
recipients string, and count the number of ";" in between?

Thanks again,

Sarah
 
D

Dmitry Streblechenko

No, you need to loop through the recipients in the Recipients collection and
for each entry check that Name or Address property matches your criteria.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
S

sleepy

Hello Dmitry,

This is my code now. It appears to work, but when I go and look at the
meeting nothing has changed. Any suggestions?

Sub CustomMeetingRequestRule(Item As Outlook.MeetingItem)
MsgBox "Beginning"
Dim oRecAdd As Recipient
Dim oRecRem As Recipients
Dim myEntries As AddressEntries
Dim myAddressEntry As AddressEntry
MsgBox Item.Recipients.Count
For i = 1 To Item.Recipients.Count
Set myAddressEntry = Item.Recipients.Item(i).AddressEntry
MsgBox myAddressEntry.Name
If myAddressEntry.Name = "PMG Reception" Then
Item.Recipients.Remove (i)
MsgBox "recipient removed"
Exit For
End If
Next i
Set oRecAdd = Item.Recipients.Add("(e-mail address removed)")
oRecAdd.Type = olBCC
oRecAdd.Resolve
Set oRecAdd = Nothing

MsgBox "its done"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top