runtime error when setting the view.xml property

R

Ronald van Aalten

Hi,

I try to create a custom view (ol2002, vb6, reference to msxml v.3.0) by
setting the .XML property after retrieving the xml data from a file. Setting
the view.xml propterty keeps generating an error. What can be wrong?

-------------------------------------
Dim oFld As Outlook.MAPIFolder
Dim oView As Outlook.View
Dim oXml As MSXML2.DOMDocument
Dim sXML As String

Set oFld = goNS.GetDefaultFolder(olFolderContacts)
' first I save the .XML property from an existing view to file:
Set oView = oFld.Views("MyView")
Set oXml = New MSXML2.DOMDocument
oXml.loadXML oView.XML
oXml.Save "c:\data\view.xml"
' now I create a new view and try to set the xml property
Set oView = oFld.Views.Add("MyViewNew", olTableView,
olViewSaveOptionAllFoldersOfType)
Set oXml = New MSXML2.DOMDocument
oXml.async = False
oXml.Load("c:\data\view.xml")
oView.XML = oXml.XML '=> runtime error 'Method XML of object
VIEW failed'
 
R

Ronald van Aalten

I replied to fast, the complete error message is:
runtime error 'Method XML of object VIEW failed
(see below)

Ronald
 
S

Sue Mosher [MVP-Outlook]

Sorry it's taken me so long to get back to you on this. The only thing I can
think of is that you don't have a valid view when you get to this statement:

oXml.loadXML oView.XML

I'd test it first:

If Not oView Is Nothing Then
oXml.loadXML oView.XML
'etc.

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