how to get RecurrencePattern via VB-Script (CDO)

M

Michael Kensy

Hi,

I'am trying to develop an outlook appointment folder application.
Everything is nearly working fine but I don't know how to get
RecurrencePattern into folderview (without using VBA)...

I think it isn't possible without some programming and accessing
field.value via CDO. So I tried to build a routine writing that pattern
into an userdefined field everytime some date&time.values change.
But I don't get it work to access the Inspector-Object by the code
inside the form. I did found some examples how to do so via VBA
but I have to do via VBS.

my code snipset:
Function getCDORecurrencePattern()
Dim myCDOItem 'As Item
Dim myCDOInspector 'As Inspector
Dim myCDOSession 'As Object

'***start CDO session
Set myCDOSession = CreateObject("MAPI.Session")
myCDOSession.Logon , , False, False
On Error Resume Next

Set myInspector = myCDOSession.ActiveInspector

'***release objects
myCDOSession.Logoff
Set myCDOInspector = Nothing
Set myCDOItem = Nothing
Set myCDOSession = Nothing
End Function
***

Isn't it possible to access inspObject that way?
 
K

Ken Slovak - [MVP - Outlook]

CDO has no concept of Inspectors. Use Item from within your form code and
get Item.EntryID and Item.Parent.StoreID to get the GUID's that identify the
open item. Then use Session.GetMessage(Item.EntryID, Item.Parent.StoreID) to
open a CDO Message item. Then you can access the Binary property for
RecurrencePattern.

If the item is in the default Calendar folder (and only there) you can open
the item as a CDO AppointmentItem and directly get the item's
RecurrencePattern property using GetRecurrencePattern. Of course you have to
check first for IsRecurring = True, or you will create a blank recurrence
pattern when you call GetRecurrencePattern.

Note that to get the GUID's the item must first have been saved, otherwise
it won't have any EntryID.
 
M

Michael Kensy

Hola Ken,

thanx for your answer...

Am Mon, 18 Oct 2004 09:40:26 -0400 schrieb Ken Slovak - [MVP - Outlook]:
CDO has no concept of Inspectors. Use Item from within your form code and
get Item.EntryID and Item.Parent.StoreID to get the GUID's that identify the
open item. Then use Session.GetMessage(Item.EntryID, Item.Parent.StoreID) to
open a CDO Message item. Then you can access the Binary property for
RecurrencePattern.


I got it working that way !
 
M

Michael Kensy

Hola Ken,

Am Tue, 19 Oct 2004 13:46:58 +0200 schrieb Michael Kensy:
I got it working that way !


but I got another problem. RecurrencePattern isn't all I wanted. I'am
looking for that kind of date and time desciption which is shown when an
appointment is recurring.
'RecurrencePattern' is giving me a pattern only that means *without* any
date or time value. So I tried to rebuild that string my way but got aware
'DateValue(Item.End)' or 'myCDOItem.Fields(CdoAppt_EndDate,
CdoPropSetID1).Value' doesn't store the end of the appointments recurring.

I do understand 'Item.End' (CDO equivalence too) delivers date of that
instance (not all of them) but how do I get that date (last occurrence) ?

Thanx again
 
K

Ken Slovak - [MVP - Outlook]

RecurrencePattern is a mess to understand if you aren't accessing it from an
appointment item in the default Calendar folder, where you can get the
Message as a CDO AppointmentItem. If the item is in some other folder or you
are working with recurring tasks you basically have to decode the binary
property for the recurrence.

Even with a RecurrencePattern you still have to use a logic tree to figure
out all the recurrence settings and how they fit together such as
Occurrences, PatternEndDate, RecurrenceType. Not only that but in figuring
out the binary the bit value meanings change from one pattern to another and
times are in seconds since January 1 of that year.

The best information I've seen about decoding the binary recurrence pattern
property is based on Dan Mitchell's pioneering work and is at
http://www.geocities.com/cainrandom/dev/MAPIRecurrence.html
 
M

Michael Kensy

Hola Ken,

thank you for that ... but it looks damned complicated to me!


Am Wed, 20 Oct 2004 10:04:55 -0400 schrieb Ken Slovak - [MVP - Outlook]:
RecurrencePattern is a mess to understand if you aren't accessing it from an
appointment item in the default Calendar folder, where you can get the
Message as a CDO AppointmentItem. If the item is in some other folder or you
are working with recurring tasks you basically have to decode the binary
property for the recurrence.


.... so is possible to decode the binary by code inside of the *form*?

Did I understand right that it is impossible to interpret
'myCDOItem.Fields(CdoAppt_RecurrenceState, CdoPropSetID1).Value'
directly? I did have a look at that value during changing recurrence
pattern (via dialogbox) but it didn't change. So I think key must be
PT_BINARY but don't know how to use that from inside the form.
May be tomorrow everything looks different ...

so thanx up to now
 
K

Ken Slovak - [MVP - Outlook]

If you don't have a CDO or Outlook object model AppointmentItem then all you
have is the binary property. And the information on that Web site is about
the only way to decode that binary.

RecurrenceState is a binary property and you can review its contents using
OutlookSpy (www.dimastr.com).




Michael Kensy said:
Hola Ken,

thank you for that ... but it looks damned complicated to me!


Am Wed, 20 Oct 2004 10:04:55 -0400 schrieb Ken Slovak - [MVP - Outlook]:
RecurrencePattern is a mess to understand if you aren't accessing it from an
appointment item in the default Calendar folder, where you can get the
Message as a CDO AppointmentItem. If the item is in some other folder or you
are working with recurring tasks you basically have to decode the binary
property for the recurrence.


... so is possible to decode the binary by code inside of the *form*?

Did I understand right that it is impossible to interpret
'myCDOItem.Fields(CdoAppt_RecurrenceState, CdoPropSetID1).Value'
directly? I did have a look at that value during changing recurrence
pattern (via dialogbox) but it didn't change. So I think key must be
PT_BINARY but don't know how to use that from inside the form.
May be tomorrow everything looks different ...

so thanx up to now
 

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