reading calendar and exclude birthday, error in V2007 french?

  • Thread starter Alain Bourgeois
  • Start date
A

Alain Bourgeois

Dear all,

I would like to read outlook appointments only, and I use the following
statements to read the outlook calendar:
DStart=#11/11/2008#
dend=#12/12/2008#

sstartfield ="[Start]"
sStr = sstartfield & ">=" & Quote(FormatDateTime(DStart, vbShortDate)) & "
and " & sstartfield & "<" & Quote(FormatDateTime(dend + 1, vbShortDate))
Set objitems = objCalendar.Items.Restrict(sStr)
For Each objitem In objitems
If objitem.Class = olAppointment Then
...


Using outlook 2007 UK: appointments are correctly selected, BUT birthdays
outside the scope (eg October 27th) also appear in filter (why why why?).
Outlook calendar event appears as "contact name's birthday". It is NOT a big
problem as I can skip these entries using:
Set app = objitem
If Not app.AllDayEvent Then
...

Till here it is ok.

BUT using Outlook 2007 French: I have to change line
sstartfield="[Début]"
Appointments are correctly selected BUT anniversary's are not AllDayEvents,
so I cannot filter them.

Is there a way to have only appointments (a way which would suit all outlook
versions, as this program runs on several environments)?

Regards,
Alain
 
J

jaimepaslabiere

No, it doesn't help.
The problem is not the date (as birthday's may really occur in range).
The problem is to skip them, so how do I know this appointment is a
"birthday" coming from the date of birth of a contact?
Testing "recurrent" is also not a solution: some persons have an
appointment reccuring every Monday at 2pm for example. I could check
the text "anniversary" or "birthday", but it is very annoying as the
text might be different across different outlook versions and
languages.
 
K

Ken Slovak - [MVP - Outlook]

Other than looking for the text for Birthday and having to change that based
on local language the only other useful characteristic would be that all
birthdays and anniversaries are linked to the contact they refer to. So my
birthday all day event (appointment) would be linked to a Ken Slovak contact
item. You can use the Links collection for that, it has the linkage (the
Contacts field in the Appointment form) and returns a collection of Link
objects. Each Link object is actually a contact item.

You can use that but it would involve checking for Links.Count > 0 and then
getting each Link item if there are any and then getting the associated
ContactItem and seeing if that matches the birthday or anniversary
properties in that contact. It's a bit of work but the only
language-insensitive method I know of for that.
 
A

Alain Bourgeois

Thanks, but I found a better solution: as Restrict(sStr) doesn't work for
some appointments, I made an easy workaround:
if not app.alldayevent and app.Start>=DStart then
... processings
'else skip
 
Top