![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]() All, I have been trying to create views through code unsuccessfully through several examples. I can run code and get at views xml where the view has been created by the Outlook GUI. Is there a straightforward way the xml generated can be used to create views on different Outlook installations/desktops? If so, are there any samples of adding a view with xml dynamically? I have seen a couple with DOM and LoadXML method, but have not gotten the views to add in the first place. Thank you! -- tom the developer |
Ads |
#2
|
|||
|
|||
![]()
I've installed custom views on machines as part of my addin run, but I
haven't done any dynamic creation of the XML. I've always used canned XML files or resources that I've created and debugged first. There's no reason why the view XML can't be created on the fly and then assigned as the current view or one of the available views for a folder or folder type, but you have to make sure any view XML created that way will actually work. If these are canned views that don't depend on something on the target system to be custom then why go through all that work? Why not just use canned XML that you know will work? Most of the sample view XML stuff I've run into has been at www.outlookcode.com. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "tomthedev" wrote in message ... All, I have been trying to create views through code unsuccessfully through several examples. I can run code and get at views xml where the view has been created by the Outlook GUI. Is there a straightforward way the xml generated can be used to create views on different Outlook installations/desktops? If so, are there any samples of adding a view with xml dynamically? I have seen a couple with DOM and LoadXML method, but have not gotten the views to add in the first place. Thank you! -- tom the developer |
#3
|
|||
|
|||
![]()
Ken,
Thank you very much for your reply. In concept, can I create the xml in the GUI, save it out or look at it, then reproduce the xml in code and add it in outlook through the code? I would think this could be the case. The only part I question is being able to add the view in code in a stable manner. I saw an example for views.add and load.xml, but could get neither to work. Perhaps if I get back to basics have a sample that works(even it is very simple)? Your help is greatly appreciated! -- tom the developer "Ken Slovak - [MVP - Outlook]" wrote: I've installed custom views on machines as part of my addin run, but I haven't done any dynamic creation of the XML. I've always used canned XML files or resources that I've created and debugged first. There's no reason why the view XML can't be created on the fly and then assigned as the current view or one of the available views for a folder or folder type, but you have to make sure any view XML created that way will actually work. If these are canned views that don't depend on something on the target system to be custom then why go through all that work? Why not just use canned XML that you know will work? Most of the sample view XML stuff I've run into has been at www.outlookcode.com. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "tomthedev" wrote in message ... All, I have been trying to create views through code unsuccessfully through several examples. I can run code and get at views xml where the view has been created by the Outlook GUI. Is there a straightforward way the xml generated can be used to create views on different Outlook installations/desktops? If so, are there any samples of adding a view with xml dynamically? I have seen a couple with DOM and LoadXML method, but have not gotten the views to add in the first place. Thank you! -- tom the developer |
#4
|
|||
|
|||
![]()
What I usually do is to set up a view in the UI as close to what I want as
possible. Then I grab that view XML and modify it by hand (or code) to add whatever else I want there. In that way for example I can add a column for a MAPI property I've added that isn't in UserProperties. Once that's done I can persist the XML as a string resource or a file and use it. Certainly you can use XML coding and the DOM to set up properly formed view XML, the end result would be the same as long as the XML is well formed for the view schema. At runtime I'd add my view XML to the MAPIFolder.Views collection either on the fly when handling a button click or an Explorer folder change event with whatever save options I wanted. Then I'd set the CurrentView to that view and save it and apply it. It seems to work OK for me. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "tomthedev" wrote in message ... Ken, Thank you very much for your reply. In concept, can I create the xml in the GUI, save it out or look at it, then reproduce the xml in code and add it in outlook through the code? I would think this could be the case. The only part I question is being able to add the view in code in a stable manner. I saw an example for views.add and load.xml, but could get neither to work. Perhaps if I get back to basics have a sample that works(even it is very simple)? Your help is greatly appreciated! -- tom the developer |
#5
|
|||
|
|||
![]() Ken, that is really insightful. Thanks again! When you add in the view, how can this be done? Must it be an Add-In (whether COM or .Net) or is an automation object in VBScript possible where Outlook is not opened? Regards, -- tom the developer "Ken Slovak - [MVP - Outlook]" wrote: What I usually do is to set up a view in the UI as close to what I want as possible. Then I grab that view XML and modify it by hand (or code) to add whatever else I want there. In that way for example I can add a column for a MAPI property I've added that isn't in UserProperties. Once that's done I can persist the XML as a string resource or a file and use it. Certainly you can use XML coding and the DOM to set up properly formed view XML, the end result would be the same as long as the XML is well formed for the view schema. At runtime I'd add my view XML to the MAPIFolder.Views collection either on the fly when handling a button click or an Explorer folder change event with whatever save options I wanted. Then I'd set the CurrentView to that view and save it and apply it. It seems to work OK for me. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "tomthedev" wrote in message ... Ken, Thank you very much for your reply. In concept, can I create the xml in the GUI, save it out or look at it, then reproduce the xml in code and add it in outlook through the code? I would think this could be the case. The only part I question is being able to add the view in code in a stable manner. I saw an example for views.add and load.xml, but could get neither to work. Perhaps if I get back to basics have a sample that works(even it is very simple)? Your help is greatly appreciated! -- tom the developer |
#6
|
|||
|
|||
![]()
Any language that supports COM can be used. But to work with Outlook it has
to be opened, no matter what language you're using. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "tomthedev" wrote in message ... Ken, that is really insightful. Thanks again! When you add in the view, how can this be done? Must it be an Add-In (whether COM or .Net) or is an automation object in VBScript possible where Outlook is not opened? Regards, -- tom the developer |
#7
|
|||
|
|||
![]()
Here is a sub I am trying to use to modify a view's XML property. It doesn't
work but I get no errors. The only thing I can infer is the XML is being rejected (withoiut an error raised), but the only editing I did was to the name description fields to be displayed. The text editor I used change some of the indent spacing in hte XML code, but I don't know if it changed EOF etc. Is there an MS XML test program to validate View.XML coding? Private Sub XMLView() Dim fso, aFile Dim newView As String Set fso = CreateObject("Scripting.FileSystemObject") Set aFile = fso.OpenTextFile("Q:\_Tools\Courts\CourtViewTest.t xt") newView = aFile.Readall aFile.Close Dim objViews As Outlook.Views Dim objView As Outlook.View Set objViews = Application.ActiveExplorer.CurrentFolder.Views Set objView = objViews.Item("Court View Test") If objView Is Nothing Then Set objView = objViews.Add("Court View Test", olCardView, olViewSaveOptionThisFolderEveryone) End If objView.XML = newView objView.Save objView.Apply objViews("Court View Test").XML = newView objViews("Court View Test").Save objViews("Court View Test").Apply MsgBox objViews("Court View Test").XML MsgBox Application.ActiveExplorer.CurrentView.XML End Sub |
#8
|
|||
|
|||
![]()
I should have added I opened the text file in MS Word but had no Outlook View
schema with which to validate it. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Task Views in Navigation Pane - How Do I Reorder Them?! | David | Outlook - General Queries | 1 | April 9th 09 04:31 PM |
Creating calendar views | Claire | Outlook - Calandaring | 3 | November 20th 08 02:42 PM |
Help Desk and Assigned Help Task Sample not creating task on cliK | doc4a | Outlook - Using Forms | 0 | July 16th 08 09:47 PM |
Can't see Tasks in any 'To Do' views, and no Task reminders (OL-20 | JokesterGuy | Outlook - Installation | 6 | September 25th 07 02:22 PM |
Can't see Tasks in any 'To Do' views, and no Task reminders (OL-20 | JokesterGuy | Outlook - Calandaring | 2 | August 31st 07 01:08 PM |