How to structure XML View filter?

J

John Riddle

Hi,

I have a Public Folder View on my machine that filters items based on me being
the owner or my name being in a custom property of task item. Here is portion
of the XML for the view that contains the filter:

<filter>(&quot;http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/811c000b&quot;
= 0 AND
(&quot;http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/811f001f&quot;
LIKE '%&quot;John Riddle&quot;%' OR
&quot;http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/Candidate%20Source&quot;
LIKE '%&quot;John Riddle&quot;%'))</filter>


What I need to do is modify this XML so that instead of the string "John
Riddle" (my name) being the filter, that a variable strUserName is used
instead. How can I modify the above code to accept a string variable? I know I
can't just replace John Riddle with " & strUserName & " since it doesn't
appear this XML accepts quotes. I see that everywhere quotes should be used,
there is a &quot; instead.

Can anyone help?

Thanks,

John
 
S

Sue Mosher [MVP-Outlook]

You would have to script the updating of the <filter> element. You cannot put a variable in the View.XML property itself.
 
J

John Riddle

How would I "script" the updating of the filter? Do you have an example?

Thanks,

John

You would have to script the updating of the <filter> element. You cannot put
a variable in the View.XML property itself.
 
S

Sue Mosher [MVP-Outlook]

You could try just using the Replace() function to replace "John Riddle" with the user's name.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

John Riddle

Duh! I can't believe I didn't think of that. Thanks!

John


You could try just using the Replace() function to replace "John Riddle" with
the user's name.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

John Riddle

Okay, that works fine for Contact Folders. However, on ANY task folder it
seems that ANY filter applied using SQL won't work. If I create a filter using
"Advanced" tab or "Query Builder" tab, everything works great. However, if I
close and re-open the filter dialog box and click on the "SQL" tab and check
the box to "Edit These Criteria Directly" (then don't change anything from the
SQL already provided from my filter set in other tabs), and then close the
dialog, no items come up in my filter at all even when I just had hundreds
using the Query Builder.

I haven't changed any of the SQL from what was provided, I only changed the
check box that I want Outlook to use the SQL on the SQL tab.

This functionality works fine for Contacts folders (I haven't tried other
types), but it NEVER works in Task folders (no matter how basic or what
criteria is being filtered).

Can anyone confirm that they can set a filter on a Task folder either
programmatically or through the filter dialog using the SQL tab? Even just try
creating a filter using the other tabs and then just switching to SQL tab and
applying. Do you also get a filter result with zero items?

Any work around?

Thanks,

John
"John Riddle" <jriddleatsignwilsongroupnyperiodcom> wrote in message
Duh! I can't believe I didn't think of that. Thanks!

John


You could try just using the Replace() function to replace "John Riddle" with
the user's name.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

What build number of Outlook? I know there were some problems with TaskPad filters in Outlook 2003 RTM.
 
J

John Riddle

I'm using Office 2003 Pro, which would be Outlook 2003. I'm not sure what
"RTM" is? I'm using the Task folder, not TaskPad. I simply have a table view
of the items in the Task folder and cannot get a SQL filter to display any
items, whether I use my own SQL or the SQL provided by Outlook based on a
"regular" advanced filter or Query Builder filter. Have you tried to do this?
It just takes a second to test. I'd like to know if I'm crazy or if this is
how it is for everyone.

Thanks,

John
What build number of Outlook? I know there were some problems with TaskPad
filters in Outlook 2003 RTM.
 
S

Sue Mosher [MVP-Outlook]

RTM = "release to manufacturing," i.e. the first public release, as opposed to later releases with service packs and hotfixes. You can get the build number from the Help | About Microsoft Outlook dialog.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

John Riddle

Thanks Sue. The build # is 11.6359.6408 SP1

Can anyone else confirm that they are getting this behavior? I've tested it on
several machines here with exactly the same results. Is there a work-around
suggested for programmatically creating views on a Task Folder that include a
filter? (views without filters work fine)

Thanks,

John

RTM = "release to manufacturing," i.e. the first public release, as opposed to
later releases with service packs and hotfixes. You can get the build number
from the Help | About Microsoft Outlook dialog.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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