The startup switch did the folowing:
1) removed our custom view and restored the Messages View.
However, once I restarted Outlook normaly our custom view was created again
and the Message View was corrupted.
To fetch the views we do this:
To create our custom view we do this:
Dim oView As Microsoft.Office.Interop.Outlook.View
oView = oFolder.Views.Add(strView,
Microsoft.Office.Interop.Outlook.OlViewType.olTableView,
Microsoft.Office.Interop.Outlook.OlViewSaveOption.olViewSaveOptionAllFoldersOfType)
Dim sb As New StringBuilder, iPos As Integer
sb.Append(oView.XML)
Dim sbView As New StringBuilde
sbView.Append("<column><heading>?</heading><prop>
http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/DLTrack</prop><type>boolean</type><width>1</width><style>padding-left:3px;;text-align:center</style><format>boolicon</format><displayformat>3</displayformat><userheading>?</userheading></column>")
sbView.Append(vbCrLf
sbView.Append(" <column><heading>Company</heading><prop>
http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/DLCompany</prop><type>string</type><width>151</width><style>padding-left:3px;;text-align:left</style><displayformat>1</displayformat><userheading>Company</userheading></column>")
sbView.Append(vbCrLf)
sbView.Append(" ")
iPos = sb.ToString.IndexOf("<heading>From")
sb.Insert(iPos - 1, sbView.ToString)
sbView = Nothing
oView.XML = sb.ToString
sb = Nothing
oView.Save()
The oView.XML looks like this:
<?xml version="1.0"?>
<view type="table">
<viewname>Exformatics Messages</viewname>
<viewstyle>table-layout:fixed;width:100%;font-family:Segoe
UI;font-style:normal;font-weight:normal;font-size:8pt;color:Black;font-charset:0</viewstyle>
<viewtime>215162475</viewtime>
<linecolor>8421504</linecolor>
<linestyle>3</linestyle>
<ensuredcategoriesfield>1</ensuredcategoriesfield>
<collapsestate/>
<rowstyle>background-color:window;color:windowtext</rowstyle>
<headerstyle>background-color:#D3D3D3</headerstyle>
<arrangement>
<autogroup>1</autogroup>
<collapseclient/>
</arrangement>
<column>
<name>HREF</name>
<prop>DAV:href</prop>
<checkbox>1</checkbox>
</column>
<column>
<heading>Importance</heading>
<prop>urn:schemas:httpmail:importance</prop>
<type>i4</type>
<bitmap>1</bitmap>
<width>10</width>
<style>padding-left:3px;;text-align:center</style>
<editable>1</editable>
</column>
<column>
<format>boolicon</format>
<heading>Reminder</heading
<prop>
http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8503000b</prop>
<type>boolean</type>
<bitmap>1</bitmap>
<width>18</width>
<style>padding-left:3px;;text-align:center</style>
<editable>1</editable>
<displayformat>3</displayformat>
</column>
<column>
<heading>Icon</heading>
<prop>
http://schemas.microsoft.com/mapi/proptag/0x0fff0102</prop>
<bitmap>1</bitmap>
<width>18</width>
<style>padding-left:3px;;text-align:center</style>
<editable>0</editable>
</column>
<column>
<heading>Flag Status</heading>
<prop>
http://schemas.microsoft.com/mapi/proptag/0x10900003</prop>
<type>i4</type>
<bitmap>1</bitmap>
<width>18</width>
<style>padding-left:3px;;text-align:center</style>
<editable>1</editable>
</column>
<column>
<format>boolicon</format>
<heading>Attachment</heading>
<prop>urn:schemas:httpmail:hasattachment</prop>
<type>boolean</type>
<bitmap>1</bitmap>
<width>10</width>
<style>padding-left:3px;;text-align:center</style>
<editable>0</editable>
<displayformat>3</displayformat>
</column>
<column>
<editable>0</editable>
<format>boolicon</format>
<heading>?</heading
<prop>
http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/DLTrack</prop>
<type>boolean</type>
<width>1</width>
<style>padding-left:3px;;text-align:center</style>
<displayformat>3</displayformat>
</column>
<column>
<editable>0</editable>
<heading>Company</heading
<prop>
http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/DLCompany</prop>
<type>string</type>
<width>151</width>
<style>padding-left:3px;;text-align:left</style>
<displayformat>1</displayformat>
</column>
<column>
<heading>From</heading>
<prop>urn:schemas:httpmail:fromname</prop>
<type>string</type>
<width>25</width>
<style>padding-left:3px;;text-align:left</style>
<editable>0</editable>
<displayformat>1</displayformat>
</column>
<column>
<heading>Subject</heading>
<prop>urn:schemas:httpmail:subject</prop>
<type>string</type>
<width>120</width>
<style>padding-left:3px;;text-align:left</style>
<editable>1</editable>
</column>
<column>
<heading>Received</heading>
<prop>urn:schemas:httpmail:datereceived</prop>
<type>datetime</type>
<width>30</width>
<style>padding-left:3px;;text-align:left</style>
<editable>0</editable>
<format>M/d/yyyy||h:mm tt</format>
<displayformat>2</displayformat>
</column>
<column>
<heading>Size</heading>
<prop>
http://schemas.microsoft.com/mapi/id/{00020328-0000-0000-C000-000000000046}/8ff00003</prop>
<type>i4</type>
<width>15</width>
<style>padding-left:3px;;text-align:left</style>
<editable>0</editable>
<displayformat>3</displayformat>
</column>
<column>
<heading>Categories</heading>
<prop>urn:schemas-microsoft-com
ffice
ffice#Keywords</prop>
<width>30</width>
<sortable>0</sortable>
<style>padding-left:3px;;text-align:left</style>
<editable>1</editable>
</column>
<orderby>
<order>
<heading>Received</heading>
<prop>urn:schemas:httpmail:datereceived</prop>
<type>datetime</type>
<sort>desc</sort>
</order>
</orderby>
<groupbydefault>2</groupbydefault>
<previewpane>
<visible>1</visible>
<markasread>0</markasread>
</previewpane>
</view>
/Martin