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
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