Outlook: filter in view doesnt work!!!! help!

D

dmitry

Hi!
I have faced really weird outlook behavior.
Have to set filter in outlook view programmatically.
I use Office XP (sp2) and MS Exchange.

To manipulate the filter, I change XML property of the
corresponding View object the way below:

// create parser xml
Set objXML = CreateObject
("MSXML2.DOMDocument.4.0")
// fetch all views from the folder
Set objViews = Application.GetNameSpace
("MAPI").Folders("Common folders").Folders
("clients").Folders("classes").Views
Set objView = objViews.Item("default")
// load into xml parser
objXML.loadXML(objView.XML)
Set objRoot = objXML.documentElement
Set newNode = objXML.createNode(1, "filter", "")
// set filter kinda "employee=test"
newNode.Text = "(""DAV:isfolder"" = false
AND ""DAV:ishidden"" = false) AND
(""http://schemas.microsoft.com/mapi/string/{00020329-0000-
0000-C000-000000000046}/Employee"" = 'Test')"
Set filterNode = objRoot.insertBefore(newNode,
objRoot.childNodes.item(1))
objView.XML = objXML.XML
'Save and apply the new view.
objView.Save
objView.Apply
Application.GetNameSpace("MAPI").Folders("Common
folders").Folders("clients").Folders("classes").Display

================
However, when I try to save the View, error
occures "Cannot save View properly".
When I create view directly from outlook's main menu,
everything works fine, unless I try to emplement SQL
automatically generated by Outlook. In this case, I
get "SQL analysis error" (and this is SQL generated by
outlook ITSELF!!!).
read of dimilar bug
(http://support.microsoft.com/default.aspx?scid=kb;en-
us;314248) but it is reported to have been fixed in SP2.
Installed update but the thing keeps appearing.
Does anyone have any suggestions????
Thanks in advance and regards ...
 

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