No MVP solved this so far - Identify one appointment in recurring meetings

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hello World,
I am getting desparate. I can not imagine i hit a problem that no one can solve after so many versions of Outlook. I posted couple of requests on this newsgroup but no real reply to the issue.

I simplified my problem to the below to make sure it is clear:

There is DAILY recurring meetings with 4 instances: Sunday to Wednesday
The user selects ONLY Monday and hit my macro.
i want to be able to know that the user selected the Monday meeting and to reject the meeting.

This is what Demitry told me on this thread and i dont think he answered the question:
"You will need to use the various recurrence properties (RecurrencePattern.RecurrenceType, RecurrencePattern.Exception, etc) to
figure out the dates of the occurences. Unfortunately there is no way to access "

I am sure there is API to detect it as if you do it manually it work and the dialog box asks you to delecet between all the sries of meetings or this one.

Thanks
David

-------------------------------------------- CODE -----------------------------------------
Public Sub RejectOnlyTheseInvites()

Dim myOlApp As Outlook.Application
Dim Appointment As Outlook.AppointmentItem
Dim MyPattern As Outlook.RecurrencePattern
Dim ThisAppointmentInstance As Outlook.AppointmentItem
Dim MyException As Outlook.Exceptions
Dim I As Integer

Set myOlApp = CreateObject("Outlook.Application")
Set Sel = myOlApp.ActiveExplorer.Selection

For I = 1 To Sel.Count
If Sel.Item(I).Class = olAppointment Then
Set Appointment = Sel.Item(I)
If Appointment.RecurrenceState = olApptNotRecurring Then
Appointment.Respond olMeetingDeclined, False, False
Else
Set MyPattern = Appointment.GetRecurrencePattern
[?????? Get the date of the selected instance]
[Exception is not marked with this selected date. can not use it]
Set ThisAppointmentInstance = MyPattern.GetOccurrence(??? a date ???? )
ThisAppointmentInstance.Respond olMeetingDeclined, False, False
End If
End If
Next

End Sub
 
YOu could use the fact that indivisual instances of a recurring
appointment all share the same messageID. The following code is untested
but may give you an approach to the problem.

Function CheckForRecurrence(ByRef objFolder as object, ByVal MessageID
as string) as boolean
' Next set a filter on the outbox for our Message ID
Set objMessageFilter = objFolder.Messages.Filter
'CDO
objMsgFilter.Fields(CdoPR_ENTRYID) = MessageID
'MAPI
'objMessageFilter.Fields(ActMsgPR_ENTRYID) = MessageID
' Test for multiple messages
If objFolder.Messages.Count > 0 Then
CheckForRecurrence=True
Else
CheckForRecurrence=True
End IF
' Clear the filter we have set
Set objMessageFilter = Nothing

End Function


---------------------------------
Trevor Lowing
Satellite Beach, Fl


(e-mail address removed)
---------------------------------
Need help with:
Access?
http://www.mvps.org/access/
Outlook?
http://www.slipstick.com/
Visio?
http://www.mvps.org/visio/
HTML/CSS?
http://www.NCDesign.org
Scripting(VBScript/JScript/WSH/XML)?
http://www.DevGuru.com
http://cwashington.netreach.net/
http://developer.irt.org/script/script.htm
---------------------------------



Hello World,
I am getting desparate. I can not imagine i hit a problem that no one can solve after so many versions of Outlook. I posted couple of requests on this newsgroup but no real reply to the issue.

I simplified my problem to the below to make sure it is clear:

There is DAILY recurring meetings with 4 instances: Sunday to Wednesday
The user selects ONLY Monday and hit my macro.
i want to be able to know that the user selected the Monday meeting and to reject the meeting.

This is what Demitry told me on this thread and i dont think he answered the question:
"You will need to use the various recurrence properties (RecurrencePattern.RecurrenceType, RecurrencePattern.Exception, etc) to
figure out the dates of the occurences. Unfortunately there is no way to access "

I am sure there is API to detect it as if you do it manually it work and the dialog box asks you to delecet between all the sries of meetings or this one.

Thanks
David

-------------------------------------------- CODE -----------------------------------------
Public Sub RejectOnlyTheseInvites()

Dim myOlApp As Outlook.Application
Dim Appointment As Outlook.AppointmentItem
Dim MyPattern As Outlook.RecurrencePattern
Dim ThisAppointmentInstance As Outlook.AppointmentItem
Dim MyException As Outlook.Exceptions
Dim I As Integer

Set myOlApp = CreateObject("Outlook.Application")
Set Sel = myOlApp.ActiveExplorer.Selection

For I = 1 To Sel.Count
If Sel.Item(I).Class = olAppointment Then
Set Appointment = Sel.Item(I)
If Appointment.RecurrenceState = olApptNotRecurring Then
Appointment.Respond olMeetingDeclined, False, False
Else
Set MyPattern = Appointment.GetRecurrencePattern
[?????? Get the date of the selected instance]
[Exception is not marked with this selected date. can not use it]
Set ThisAppointmentInstance = MyPattern.GetOccurrence(??? a date ???? )
ThisAppointmentInstance.Respond olMeetingDeclined, False, False
End If
End If
Next

End Sub
 
Sorry about that first one. Here we go again....

You could use the fact that individual instances of a recurring
appointment all share the same messageID. The following code is untested
but may give you an approach to the problem.

Function CheckForRecurrence(ByRef objFolder As Object, ByVal MessageID
As String) As Boolean
' Next set a filter on the outbox for our Message ID
Set objMessageFilter = objFolder.Messages.Filter
'CDO
objMsgFilter.Fields(CdoPR_ENTRYID) = MessageID
'MAPI
'objMessageFilter.Fields(ActMsgPR_ENTRYID) = MessageID
' Test for multiple messages
If objFolder.Messages.Count > 0 Then
CheckForRecurrence = True
Else
CheckForRecurrence = False
End If
' Clear the filter we have set
Set objMessageFilter = Nothing

End Function

---------------------------------
Trevor Lowing
Satellite Beach, Fl

(e-mail address removed)
---------------------------------
Need help with:
Access?
http://www.mvps.org/access/
Outlook?
http://www.slipstick.com/
Visio?
http://www.mvps.org/visio/
HTML/CSS?
http://www.NCDesign.org
Scripting(VBScript/JScript/WSH/XML)?
http://www.DevGuru.com
http://cwashington.netreach.net/
http://developer.irt.org/script/script.htm
---------------------------------


Hello World,
I am getting desparate. I can not imagine i hit a problem that no one can solve after so many versions of Outlook. I posted couple of requests on this newsgroup but no real reply to the issue.

I simplified my problem to the below to make sure it is clear:

There is DAILY recurring meetings with 4 instances: Sunday to Wednesday
The user selects ONLY Monday and hit my macro.
i want to be able to know that the user selected the Monday meeting and to reject the meeting.

This is what Demitry told me on this thread and i dont think he answered the question:
"You will need to use the various recurrence properties (RecurrencePattern.RecurrenceType, RecurrencePattern.Exception, etc) to
figure out the dates of the occurences. Unfortunately there is no way to access "

I am sure there is API to detect it as if you do it manually it work and the dialog box asks you to delecet between all the sries of meetings or this one.

Thanks
David

-------------------------------------------- CODE -----------------------------------------
Public Sub RejectOnlyTheseInvites()

Dim myOlApp As Outlook.Application
Dim Appointment As Outlook.AppointmentItem
Dim MyPattern As Outlook.RecurrencePattern
Dim ThisAppointmentInstance As Outlook.AppointmentItem
Dim MyException As Outlook.Exceptions
Dim I As Integer

Set myOlApp = CreateObject("Outlook.Application")
Set Sel = myOlApp.ActiveExplorer.Selection

For I = 1 To Sel.Count
If Sel.Item(I).Class = olAppointment Then
Set Appointment = Sel.Item(I)
If Appointment.RecurrenceState = olApptNotRecurring Then
Appointment.Respond olMeetingDeclined, False, False
Else
Set MyPattern = Appointment.GetRecurrencePattern
[?????? Get the date of the selected instance]
[Exception is not marked with this selected date. can not use it]
Set ThisAppointmentInstance = MyPattern.GetOccurrence(??? a date ???? )
ThisAppointmentInstance.Respond olMeetingDeclined, False, False
End If
End If
Next

End Sub


--
 
Trevor Lowing said:
Sorry about that first one. Here we go again....

You could use the fact that individual instances of a recurring
appointment all share the same messageID. The following code is untested
but may give you an approach to the problem.

Function CheckForRecurrence(ByRef objFolder As Object, ByVal MessageID
As String) As Boolean
' Next set a filter on the outbox for our Message ID
Set objMessageFilter = objFolder.Messages.Filter
'CDO
objMsgFilter.Fields(CdoPR_ENTRYID) = MessageID
'MAPI
'objMessageFilter.Fields(ActMsgPR_ENTRYID) = MessageID
' Test for multiple messages
If objFolder.Messages.Count > 0 Then
CheckForRecurrence = True
Else
CheckForRecurrence = False
End If
' Clear the filter we have set
Set objMessageFilter = Nothing

End Function

---------------------------------
Trevor Lowing
Satellite Beach, Fl

(e-mail address removed)
---------------------------------
Need help with:
Access?
http://www.mvps.org/access/
Outlook?
http://www.slipstick.com/
Visio?
http://www.mvps.org/visio/
HTML/CSS?
http://www.NCDesign.org
Scripting(VBScript/JScript/WSH/XML)?
http://www.DevGuru.com
http://cwashington.netreach.net/
http://developer.irt.org/script/script.htm
can solve after so many versions of Outlook. I posted couple of requests on
this newsgroup but no real reply to the issue.the dialog box asks you to delecet between all the sries of meetings or this
one.
Thanks
David

-------------------------------------------- CODE -----------------------------------------
Public Sub RejectOnlyTheseInvites()

Dim myOlApp As Outlook.Application
Dim Appointment As Outlook.AppointmentItem
Dim MyPattern As Outlook.RecurrencePattern
Dim ThisAppointmentInstance As Outlook.AppointmentItem
Dim MyException As Outlook.Exceptions
Dim I As Integer

Set myOlApp = CreateObject("Outlook.Application")
Set Sel = myOlApp.ActiveExplorer.Selection

For I = 1 To Sel.Count
If Sel.Item(I).Class = olAppointment Then
Set Appointment = Sel.Item(I)
If Appointment.RecurrenceState = olApptNotRecurring Then
Appointment.Respond olMeetingDeclined, False, False
Else
Set MyPattern = Appointment.GetRecurrencePattern
[?????? Get the date of the selected instance]
[Exception is not marked with this selected date. can not use it]
Set ThisAppointmentInstance = MyPattern.GetOccurrence(??? a date ???? )
ThisAppointmentInstance.Respond olMeetingDeclined, False, False
End If
End If
Next

End Sub
 
Thanks Trevor. but you did not reply to my question.

I am able to identify that it is a recurring meeting. i simply do it by

If Appointment.RecurrenceState = olApptNotRecurring Then

What i am missing is the ability to tell which INSTANCE of the recurring
meetings
the user selected. I need to extract the date and time of ONE SELECTED
INSTANCE.

PS: i am using outlook 2003

Thanks
David

Trevor Lowing said:
Sorry about that first one. Here we go again....

You could use the fact that individual instances of a recurring
appointment all share the same messageID. The following code is untested
but may give you an approach to the problem.

Function CheckForRecurrence(ByRef objFolder As Object, ByVal MessageID
As String) As Boolean
' Next set a filter on the outbox for our Message ID
Set objMessageFilter = objFolder.Messages.Filter
'CDO
objMsgFilter.Fields(CdoPR_ENTRYID) = MessageID
'MAPI
'objMessageFilter.Fields(ActMsgPR_ENTRYID) = MessageID
' Test for multiple messages
If objFolder.Messages.Count > 0 Then
CheckForRecurrence = True
Else
CheckForRecurrence = False
End If
' Clear the filter we have set
Set objMessageFilter = Nothing

End Function

---------------------------------
Trevor Lowing
Satellite Beach, Fl

(e-mail address removed)
---------------------------------
Need help with:
Access?
http://www.mvps.org/access/
Outlook?
http://www.slipstick.com/
Visio?
http://www.mvps.org/visio/
HTML/CSS?
http://www.NCDesign.org
Scripting(VBScript/JScript/WSH/XML)?
http://www.DevGuru.com
http://cwashington.netreach.net/
http://developer.irt.org/script/script.htm
can solve after so many versions of Outlook. I posted couple of requests on
this newsgroup but no real reply to the issue.the dialog box asks you to delecet between all the sries of meetings or this
one.
Thanks
David

-------------------------------------------- CODE -----------------------------------------
Public Sub RejectOnlyTheseInvites()

Dim myOlApp As Outlook.Application
Dim Appointment As Outlook.AppointmentItem
Dim MyPattern As Outlook.RecurrencePattern
Dim ThisAppointmentInstance As Outlook.AppointmentItem
Dim MyException As Outlook.Exceptions
Dim I As Integer

Set myOlApp = CreateObject("Outlook.Application")
Set Sel = myOlApp.ActiveExplorer.Selection

For I = 1 To Sel.Count
If Sel.Item(I).Class = olAppointment Then
Set Appointment = Sel.Item(I)
If Appointment.RecurrenceState = olApptNotRecurring Then
Appointment.Respond olMeetingDeclined, False, False
Else
Set MyPattern = Appointment.GetRecurrencePattern
[?????? Get the date of the selected instance]
[Exception is not marked with this selected date. can not use it]
Set ThisAppointmentInstance = MyPattern.GetOccurrence(??? a date ???? )
ThisAppointmentInstance.Respond olMeetingDeclined, False, False
End If
End If
Next

End Sub
 
The routine below should identify the selected item or the first item if
multiple items are selected. From there it should be trivial to look at
the item's properties. Unless you are saying that selecting one item of
a recurring appointment returns a collection of appointments?

Function GetSelection() As object
'g_objHostApp is the Outlook.Application instance referenced at the
global level


Dim objItem,objSel as object
Select Case g_objHostApp.ActiveWindow.Class
Case olExplorer
Set objSel = g_objHostApp.ActiveExplorer.Selection
If objSel.Count > 0 Then
Set objItem = objSel.Item(1)
End If
Case olInspector
Set objItem = g_objHostApp.ActiveInspector.CurrentItem
End Select

'reply bug
If objItem.Class <> olTask or objItem.Class <> olAppointment Then
Set objSel = g_objHostApp.ActiveExplorer.Selection
If objSel.Count > 0 Then
Set objItem = objSel.Item(1)
End If
End If

'weed out the wrong junk
If objItem.Class <> olTask or objItem.Class <> olAppointment Then
Set objItem = Nothing
Else
Set GetSelection = objItem
End If


End Function

--
---------------------------------
Trevor Lowing
Satellite Beach, Fl

(e-mail address removed)
---------------------------------
Need help with:
Access?
http://www.mvps.org/access/
Outlook?
http://www.slipstick.com/
Visio?
http://www.mvps.org/visio/
HTML/CSS?
http://www.NCDesign.org
Scripting(VBScript/JScript/WSH/XML)?
http://www.DevGuru.com
http://cwashington.netreach.net/
http://developer.irt.org/script/script.htm
---------------------------------
 
Trever,

Thanks for taking the time to explore this with me.
You can see my code at the bottom of the mail.

Answering your question (using your example):

objItem is an appointment and its propoerties contain the recurring
information and NOT the specific instance
that is actually selected. Yes it is a collection of appointments.
I just need the date and time for the selected item.

Thanks Again
David

Here is the core of my code again:


Set myOlApp = CreateObject("Outlook.Application")
Set Sel = myOlApp.ActiveExplorer.Selection

For I = 1 To Sel.Count
If Sel.Item(I).Class = olAppointment Then
Set Appointment = Sel.Item(I)
If Appointment.RecurrenceState = olApptNotRecurring Then
Appointment.Respond olMeetingDeclined, False, False
Else
Set MyPattern = Appointment.GetRecurrencePattern
Set ThisAppointmentInstance =
MyPattern.GetOccurrence(???????)
ThisAppointmentInstance.Respond olMeetingDeclined, False,
False
End If
End If
Next
 
Hello,
Sue Mosher replied to me on this issue and i wanted you to get this as well:

"As far as I can tell, an appointment from Explorer.Selection always reports
its RecurrenceState as olApptMaster, which means you can't know what
occurrence it actually is.

Many, many bits of Outlook UI functionality are not exposed
programmatically. "

So, i changed the subject to replect this... :(

David
 
Back
Top