I've made a small macro based on the perl script you can find at
http://www.rallenhome.com/scripting.html and
http://www.rallenhome.com/scripting/src/outlook_set_folder_views.pls.txt
To use at your own risk. It applies to all Folder with the `Messages' view a new
updated version of the view. The XML below is the version I like to use to look
at my folders, so be careful when changing it otherwise it might mess up
outlook. Use `outlook /cleanviews' in case something wrong happen.
Hope this helps,
Regards,
Manu
Sub reset_views()
Dim objApp As Outlook.Application
Dim objOutlook As Outlook.NameSpace
Dim my_folder As Outlook.MAPIFolder
Set objApp = CreateObject("Outlook.Application")
Set objOutlook = objApp.GetNamespace("MAPI")
For Each my_folder In objOutlook.Folders
Call reset_folder_view(my_folder)
Next
End Sub
Sub reset_folder_view(a_folder As Outlook.MAPIFolder)
Dim my_folder As Outlook.MAPIFolder
If Not (a_folder Is Nothing) Then
Call set_view(a_folder)
For Each my_folder In a_folder.Folders
Call reset_folder_view(my_folder)
Next
End If
End Sub
Sub set_view(a_folder As Outlook.MAPIFolder)
Dim l_views As Outlook.Views
Dim l_view As Outlook.View
Set l_views = a_folder.Views
Set l_view = a_folder.Views.Item("Messages")
If Not (l_view Is Nothing) Then
Dim l_xml As String
l_xml = "<?xml version=""1.0""?>\n<view type=""table"">\n
<viewname>Messages</viewname>\n
<viewstyle>table-layout:fixed;width:100%;font-family:Tahoma;font-style:normal;fo
nt-weight:normal;font-size:8pt;color:Black;font-charset:0</viewstyle>\n
<viewtime>211998574</viewtime>\n <linecolor>8421504</linecolor>\n
<linestyle>3</linestyle>\n <usequickflags>1</usequickflags>\n
<collapsestate></collapsestate>\n
<rowstyle>background-color:#FFFFFF</rowstyle>\n
<headerstyle>background-color:#D3D3D3</headerstyle>\n
<previewstyle>color:Blue</previewstyle>\n <arrangement>\n
<autogroup>0</autogroup>\n <collapseclient></collapseclient>\n
</arrangement>\n <column>\n <name>HREF</name>\n
<prop>DAV:href</prop>\n <checkbox>1</checkbox>\n </column>\n
<column>\n <format>boolicon</format>\n"
l_xml = l_xml & "<heading>Attachment</heading>\n
<prop>urn:schemas:httpmail:hasattachment</prop>\n <type>boolean</type>\n
<bitmap>1</bitmap>\n <width>10</width>\n
<style>padding-left:3px;;text-align:center</style>\n
<displayformat>3</displayformat>\n </column>\n <column>\n
<heading>Icon</heading>\n
<prop>
http://schemas.microsoft.com/mapi/proptag/0x0fff0102</prop>\n
<bitmap>1</bitmap>\n <width>18</width>\n
<style>padding-left:3px;;text-align:center</style>\n </column>\n
<column>\n <heading>From</heading>\n
<prop>urn:schemas:httpmail:fromname</prop>\n <type>string</type>\n
<width>231</width>\n <style>padding-left:3px;;text-align:left</style>\n
<displayformat>1</displayformat>\n </column>\n <column>\n
<heading>Subject</heading>\n <prop>urn:schemas:httpmail:subject</prop>\n
<type>string</type>\n <width>375</width>\n"
l_xml = l_xml & "<style>padding-left:3px;;text-align:left</style>\n
</column>\n <column>\n <heading>To</heading>\n
<prop>urn:schemas:httpmail:displayto</prop>\n <type>string</type>\n
<width>206</width>\n <style>padding-left:3px;;text-align:left</style>\n
</column>\n <column>\n <heading>Sent</heading>\n
<prop>urn:schemas:httpmail:date</prop>\n <type>datetime</type>\n
<width>152</width>\n <style>padding-left:3px;;text-align:left</style>\n
<format>M/d/yyyy||h:mm tt</format>\n <displayformat>2</displayformat>\n
</column>\n <column>\n <heading>Size</heading>\n
<prop>
http://schemas.microsoft.com/mapi/id/{00020328-0000-0000-C000-000000000046
}/8ff00003</prop>\n <type>i4</type>\n <width>47</width>\n
<style>padding-left:3px;;text-align:left</style>\n"
l_xml = l_xml & "<displayformat>3</displayformat>\n </column>\n
<column>\n <heading>Flag Status</heading>\n
<prop>
http://schemas.microsoft.com/mapi/proptag/0x10900003</prop>\n
<type>i4</type>\n <bitmap>1</bitmap>\n <width>18</width>\n
<style>padding-left:3px;;text-align:center</style>\n </column>\n
<orderby>\n <order>\n <heading>Sent</heading>\n
<prop>urn:schemas:httpmail:date</prop>\n <type>datetime</type>\n
<sort>desc</sort>\n </order>\n </orderby>\n <multiline>\n
<gridlines>0</gridlines>\n <linestyle>0</linestyle>\n </multiline>\n
<groupbydefault>2</groupbydefault>\n <previewpane>\n
<visible>1</visible>\n <markasread>0</markasread>\n
</previewpane>\n</view>\n\n\n\n"
l_view.XML = l_xml
l_view.Save
l_view.Apply
End If
End Sub
Randy Lane said:
Is there a way to modify a defined view and have the changes applied to all folders?
For example, suppose I have a simple installation with just ten mail folders.
I define a new view and make it available to all folders in Outlook.
Any time I try to modify the defined view, the changes are only propagated to
the folder that was active when the view definition was modified.