View Full Version : Trap and check new appointment before sending
mallycat
05-16-2012, 01:30 AM
Hi
I use a telephone conferencing service for a lot of teleconferences. I want to check my outbound invitations to check that if I have placed "Intercall" in the location field, then make sure I have attached the intercall teleconference details in the body.
I got this to work using the subject field, but not the location field. I assume that the Application_ItemSend event traps the item as an email and not as an Invitation, hence it can't reference the "location" field. Can someone help me get this working to test the location field in my outbound email/invitation.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
X = Item.Type
If Item.Location Like "*Intercall*" Then
If Item.Body Like "*Intercall Teleconference Details*" Then
Else
Cancel = True
MsgBox "You forgot to add Intercall Signature"
End If
End If
End Sub
JP2112
05-23-2012, 06:39 PM
Try this and let us know if it works:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim appt As Outlook.AppointmentItem
If TypeName(Item) = "AppointmentItem" Then
Set appt = Item
Else
Exit Sub
End If
If InStr(appt.Location, "Intercall") > 0 Then
If InStr(appt.Body, "Intercall Teleconference Details") = 0 Then
Cancel = True
MsgBox "You forgot to add Intercall Signature"
End If
End If
End Sub
mallycat
05-23-2012, 08:40 PM
Thanks for your help. It didn't work, but I have made some more progress using your suggestions. It seems that the type is Outlook.meetingitem and not outlook.appointmentitem.
The trouble I am having is referencing the location field. I would expect to be able to addresss the field outlook.meetingitem.location but there is no such property.
I have tried to find it stored somewhere in outlook.meetingitem.itemproperties but can't find it.
Any ideas?
CSharpCoding
02-26-2013, 07:15 AM
Was this resolved? If so what is the solution? I have written an addin where on the send button event I need to change the meeting request's "Location". I am able to change for the sender's side but the recipients on receiving the meeting request do not see the change. Here is the code that I have written in C# to change the subject and location:
//SUBJECT
//For sender's subject text
meeting.GetAssociatedAppointment(false).Subject += " " + " Change";
meeting.GetAssociatedAppointment(false).Save();
//for receivers subject text
meeting.Subject += " " + " Change";
//LOCATION
//for senders location text
meeting.GetAssociatedAppointment(false).Location+= " " + " Change";
meeting.GetAssociatedAppointment(false).Save();
Here there is no property for the meetingitem object which would have changed the location on the recipient side. I know this is more of a VB forum, but if someone could help me with VB code I can use the same on the C# side.
Thanks in advance for the help
mallycat
03-01-2013, 10:14 PM
Yes, I sorted out my problem. This is my code
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim myAppt As AppointmentItem
Select Case TypeName(Item)
Case "MeetingItem"
On Error GoTo ExitHere: 'if it is an appointment forwarded or if INTERCALL is not found, then it may trigger an error
Set myAppt = Item.GetAssociatedAppointment(False)
If InStr(UCase(myAppt.Location), "INTERCALL") Then
If myAppt.Organizer = "My Name Here" Then 'only check my own meetings
If InStr(myAppt.Body, "Intercall") = False Then
MsgBox ("Please add dial in details before sending")
If myAppt.MeetingStatus <> 5 Then
'5 means cancelled. Don't stop the meeting update going out if the meeting has been cancelled
Cancel = True
Exit Sub
End If
End If
End If
End If
ExitHere:
End Select
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.