Problem with Restrict method on Items Collection


G

Guest

hi

I have a collection of Appointment Items (myItems) which I want to Restrict based on date range, and a specific EntryID. Because the Restrict method can't be used with EntryID, when I each Item is first created I copy EntryID to the BillingInformation property. However when I include the BillingInformation clause in the Filter, there are no items returned.

An example of my Restrict Filter is:

[Start] > "Monday Dec 29 2003 09:30 AM" And [Start] < "Sunday Feb 22 2004 10:30 PM" And [BillingInformation] = "00000000190D5BCF4CBF654B96ADB4D8C1565E5D04712400"

Yet when I exclude the BillingInformation check from the Filter, and execute the following code, the If Then condition is met!

For Each myItem In myRestrictItems
If myItem.BillingInformation = myAppoint.BillingInformation Then
....
[this code executes!]
.....
End If
Next

Any ideas please?
 
Ad

Advertisements

D

Dmitry Streblechenko

If you already know the entry id, why not use Namespace.GetItemFromID?

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


AndyK said:
hi

I have a collection of Appointment Items (myItems) which I want to
Restrict based on date range, and a specific EntryID. Because the Restrict
method can't be used with EntryID, when I each Item is first created I copy
EntryID to the BillingInformation property. However when I include the
BillingInformation clause in the Filter, there are no items returned.
An example of my Restrict Filter is:

[Start] > "Monday Dec 29 2003 09:30 AM" And [Start] < "Sunday Feb 22 2004
10:30 PM" And [BillingInformation] =
"00000000190D5BCF4CBF654B96ADB4D8C1565E5D04712400"
Yet when I exclude the BillingInformation check from the Filter, and
execute the following code, the If Then condition is met!
For Each myItem In myRestrictItems
If myItem.BillingInformation = myAppoint.BillingInformation Then
....
[this code executes!]
.....
End If
Next

Any ideas please?
 
G

Guest

Thanks for responding.

Your method would get me the master Item, but I need to be able to loop round all the recurrence instances of the Appointment between two dates... Don't think I can do this without accessing a collection of Items?

----- Dmitry Streblechenko wrote: -----

If you already know the entry id, why not use Namespace.GetItemFromID?

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

Advertisements

D

Dmitry Streblechenko

True, in case of recurring items the search can be weird as Outlook does not
use MAPI since recurrences are not real messages on the MAPI level.
Try to add an extra restriction on the subject, then loop through all
returned items - I doubt it'll be a big performance hit.

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


AndyK said:
Thanks for responding.

Your method would get me the master Item, but I need to be able to loop
round all the recurrence instances of the Appointment between two dates...
Don't think I can do this without accessing a collection of Items?
 

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