Eric,
Thanks. That gave me some really good ideas. How do I get the Message Count
for a VIEW? I know how to do this for an Items Collection, but that doesn't
help me to know if the new item is also part of the filtered results.
I've looked at the properties for the View object and there doesn't seem to be
a "count" property. I could of coarse, apply the filter and get the items
count, but that general takes 2-10 seconds depending upon the complexity of
the filter. I can't lockup everyone's computer for 2-10 seconds every time
anyone else in the office saves a contact. People would be constantly
interupted from what they were doing in Outlook just to check if by chance the
new contact saved by someone else matches a very specific search that they had
saved.
I have over 150 custom properties in my custom contact form so I'd have to add
these to the list to use option 3. Actually, option 3 was what I thought I'd
have to do originally, but was hoping for an easier solution if available as
I'm not sure if that would hange outlook as well each time the code processed.
Thanks,
John
"Eric Legault [MVP - Outlook]" <(E-Mail Removed)> wrote in
message news:9F1EE6D5-A98B-4072-9515-(E-Mail Removed)...
I can think of a few ways to handle this, but I'm not sure which is the best
approach:
- you can use the AdvancedSearch method to return a result set using the
current filter, and loop through it to see if the new message is in there; it
*shouldn't* consume too much time, but test and see
- what about tracking the last message counts for the particular view (or
all of them), and when the new item comes in, see if the message count for
the folder with the view applied has incremented by one - if it has, then the
message satisfied that criteria
- otherwise you'd have to extract the DASL properties from the filter, and
map it to the relevant Outlook Object Model property. This would probabaly
involve reading the mapped values from a file though, unless you laboriously
coded the mappings. You can see the mappings on OutlookCode.com at
http://www.outlookcode.com/files/schema.zip
--
Eric Legault - B.A, MCP, MCDBA, MCSD (VS 6.0), Outlook MVP
Try Picture Attachments Wizard -
http://tinyurl.com/ckytm
Job:
http://www.imaginets.com
Blog:
http://blogs.officezealot.com/legault/
"John Riddle" wrote:
> Hello,
>
> I have some custom code that allows a user to save a view (such as when they
> run a filter against items in a public folder). Now the users want a
> notification when a new item is added to the folder that fits one of their
> custom filters. I can easily create a newitem event for the folder and then
> check the custom views whenever an item is added to get the various filters
> that might be applied. The resulting filtered part of the XML would look
> like
> this:
>
> <filter>("urn:schemas:httpmail:textdescription" LIKE '%oracle%' AND
> "urn:schemas:httpmail:textdescription" LIKE '%java%' AND
> "urn:schemas:httpmail:textdescription" LIKE '%unix%')</filter>
>
> Now, I don't want to run each saved filter against the folder and check to
> see
> if any of the resulting items match the item just added. That would hang the
> user's computer for too long each and every time an item was added to the
> public folder. What I would like to do is simply check this filter against
> the
> one (1) new item itself.
>
> Can somebody tell me if there's an easy way to see if the new item's
> (contact
> item) properties match those specified in the custom filter?
>
> Thanks,
>
> John
>
>
>