Custom view is not working

D

Dhananjay

Hi All,
I am creating custom view. Following is my code snippet of one of my
commandbar button.

'-------------------------------------------------------------------------------------------------------------------
myView = CustomPublicFolder.Views("By Company")
myView.Reset()
myView.Apply()
AddTrace("Company View obtained")
objXML = CreateObject("MSXML2.DOMDocument.4.0")
AddTrace("XML object created")
' load into xml parser
objXML.loadXML(myView.XML)
AddTrace("XML Loaded")
objRoot = objXML.documentElement
AddTrace("Root obtained")
newNode = objXML.createNode(1, "filter", "")
AddTrace("Filter node created")
newNode.Text = """http://schemas.microsoft.com/mapi/string/
{00020329-0000-0000-C000-000000000046}/myCustomField"" LIKE '%" &
FilterType & "%'"
AddTrace("Filter applied - " & FilterType)
filterNode = objRoot.insertBefore(newNode,
objRoot.childNodes.Item(1))
myView.XML = objXML.XML

'Save and apply the new view.
myView.Save()
AddTrace("View Saved partially")
If objRoot.selectSingleNode("groupbydefault") Is Nothing
Then
newNode = objXML.createNode(1, "groupbydefault", "")
filterNode = objRoot.insertBefore(newNode,
objRoot.childNodes.Item(1))
Else
newNode = objRoot.selectSingleNode("groupbydefault")
End If
newNode.Text = "1"
AddTrace("Created collapsed view of company")
myView.XML = objXML.XML

'Save and apply the new view.
myView.Save()
AddTrace("View saved")
myView.Apply()
'-------------------------------------------------------------------------------------------------------------------
This code is working fine on all of our machines (with clean machines
too). But on one of our client machine it is not working. If I print
myView.xml in the trace file then it is showing me perfect xml, but
view is not applied successfully.
My addin is VSTO addin for office 2003 in VB2005.

Thanks,
Dhananjay
 
K

Ken Slovak - [MVP - Outlook]

And what's not working?

If it's not showing the custom property is that property on those items and
added to the folder properties?

Other than that you're going to have to find out what's different about your
machines and where it's not working.
 
D

Dhananjay

Thanks Ken for your valuable reply,
And what's not working?
Ans: My view is not working. Custom property is added to folder
properties.
Now, as per Sue suggested, I selected different folder first & then
selected my custom folder again, it is showing me the currect view!!
So I changed the folder programmatically to inbox or contacts folder &
then switch back to my custom public folder. It works for 2 times &
after that, control remains in the Inbox folder, so I had to select my
custom folder again manually. Any ideas?
Other than that you're going to have to find out what's different about your
machines and where it's not working.
Ans: I checked on "working" computer & "not working" computer for
environment, I found that
OS is same on both PCs (Windows XP)
SP of OS is same (SP 2)
All updates are fine for OS
Office 2003 SP3 is same on both PCs
User account rights are same on both PCs
What else I should check?
Thanks again,
Dhananjay
 
K

Ken Slovak - [MVP - Outlook]

I have no idea why switching folders would work twice and not after that
unless something is being garbage collected or going out of scope.

If it works on one computer and not another there has to be something
different. Check for COM addins, use of synch software and PDA type devices,
other applications that are running at that time and anything else you can
think of.
 

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

Similar Threads


Top