none
MS Outlook: Add AutoFormat Rule (Conditional Formating) using native code RRS feed

Answers

  • Hello a_ user,

    You are right, Outlook was built on top of Extended MAPI.

    But rules belong to Outlook features only. Extended MAPI doesn't provide anything for this.

    Tuesday, February 25, 2014 11:12 AM
  • VSTO really has nothing to do with this, the same thing would apply also in a shared COM addin. As Sue said back in 2007, it's how Outlook works and has not been fixed or changed.

    Do what Sue suggested, write your code and apply it when Outlook starts.


    Ken Slovak MVP - Outlook

    Tuesday, February 25, 2014 3:23 PM
    Moderator
  • > Is there a way to make import or export a custom view from/to Outlook?

    The XML property of the View class can be used for this. It returns or sets a string value that specifies the XML definition of the current view.

    Tuesday, February 25, 2014 4:21 PM
  • Hello a_,

    The conditional formatting is not stored between sessions. So, you need to re-apply it each time Outlook starts.

    Wednesday, February 26, 2014 11:03 AM
  • Conditional formatting is stored in the data store as a hidden item. It's not part of View.XML, it's stored separately. It will persist between Outlook sessions as long as a named view is set with the formatting, if a default view is set up with conditional formatting it likely won't survive between sessions.

    Ken Slovak MVP - Outlook

    Wednesday, February 26, 2014 3:00 PM
    Moderator

All replies

  • Hello a_ user,

    You are right, Outlook was built on top of Extended MAPI.

    But rules belong to Outlook features only. Extended MAPI doesn't provide anything for this.

    Tuesday, February 25, 2014 11:12 AM
  • VSTO really has nothing to do with this, the same thing would apply also in a shared COM addin. As Sue said back in 2007, it's how Outlook works and has not been fixed or changed.

    Do what Sue suggested, write your code and apply it when Outlook starts.


    Ken Slovak MVP - Outlook

    Tuesday, February 25, 2014 3:23 PM
    Moderator
  • Hi Ken,

    Thanks! We've tried the suggested "work-around", but it does not solve a problem.

    • Rule should be applied every time a user select a different folder, but this cause to Chinese font in Inbox (See details http://social.msdn.microsoft.com/Forums/office/en-US/6e5a9b1a-bc1b-4365-a481-4055f0b80b90/autoformatting-rule-workaround-fills-inbox-with-gibberish-or-chinese-fonts-during-change-of-folder?forum=outlookdev)
    • Once an add-on disable, the rule is applied on every item in a folder - so it confuse users :(

    I'm looking a way to create view with conditional formatting automatically. We have many customers that can't do it manually.

    Is there a way to make import or export a custom view from/to Outlook?

    Thanks!

    Tuesday, February 25, 2014 3:59 PM
  • As nothing has changed with this since 2007 at least I don't expect any changes now.

    If you open a support incident my guess is the bug would be classed as "will not fix" or as "by design". The only way you'd get anything in that case would be to build a business case for fixing the problem, or paying for a hot fix.

    I don't see any other options for you other than abandoning what is known not to work.


    Ken Slovak MVP - Outlook

    Tuesday, February 25, 2014 4:11 PM
    Moderator
  • > Is there a way to make import or export a custom view from/to Outlook?

    The XML property of the View class can be used for this. It returns or sets a string value that specifies the XML definition of the current view.

    Tuesday, February 25, 2014 4:21 PM
  • Thanks Eugene! 

    The XML property of the View contains information about columns in that view, but I did not find anything refers to AutoFormatRule that belong to that view.

    Do you know where a definition of the conditional formatting rules for the view is stored?

    <?xml version="1.0"?>
    <view type="table">
    	<viewname>MyView</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>217297865</viewtime>
    	<linecolor>8421504</linecolor>
    	<linestyle>3</linestyle>
    	<ensuredcategoriesfield>1</ensuredcategoriesfield>
    	<collapsestate/>
    	<rowstyle>background-color:White;color:Black</rowstyle>
    	<headerstyle>background-color:#D3D3D3</headerstyle>
    	<previewstyle/>
    	<arrangement>
    		<autogroup>1</autogroup>
    		<persistgroups>1</persistgroups>
    		<upgradetoconv>1</upgradetoconv>
    		<enablexfc>1</enablexfc>
    		<collapseclient/>
    		<collapseconv>1E000000</collapseconv>
    		<upgradetoconvchangenum>2</upgradetoconvchangenum>
    	</arrangement>
    	<multiline>
    		<gridlines>0</gridlines>
    	</multiline>
    	<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>
    		<maxrows>108593152</maxrows>
    		<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>
    		<maxrows>7208960</maxrows>
    		<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>
    		<maxrows>106954752</maxrows>
    		<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>
    		<heading>From</heading>
    		<prop>urn:schemas:httpmail:fromname</prop>
    		<type>string</type>
    		<width>53</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>257</width>
    		<style>padding-left:3px;;text-align:left</style>
    		<editable>1</editable>
    	</column>
    	<column>
    		<heading>MyField1</heading>
    		<prop>http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField1</prop>
    		<type>string</type>
    		<width>26</width>
    		<style>padding-left:3px;;text-align:left</style>
    		<editable>1</editable>
    	</column>
    	<column>
    		<heading>MyField2</heading>
    		<prop>http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField2</prop>
    		<type>string</type>
    		<width>102</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>64</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>32</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:office:office#Keywords</prop>
    		<width>65</width>
    		<sortable>0</sortable>
    		<style>padding-left:3px;;text-align:left</style>
    		<editable>1</editable>
    	</column>
    	<groupby>
    		<order>
    			<heading>Conversation</heading>
    			<prop>urn:schemas:httpmail:thread-topic</prop>
    			<type>string</type>
    			<sort>asc</sort>
    		</order>
    	</groupby>
    	<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>
    


    Wednesday, February 26, 2014 7:43 AM
  • Hello a_,

    The conditional formatting is not stored between sessions. So, you need to re-apply it each time Outlook starts.

    Wednesday, February 26, 2014 11:03 AM
  • Eugene,

    A conditional formatting which added programmatically is not stored in the same session either. Selecting a different folder marks all rows, because AutoFormatRule's filter is empty.

    Wednesday, February 26, 2014 12:32 PM
  • Conditional formatting is stored in the data store as a hidden item. It's not part of View.XML, it's stored separately. It will persist between Outlook sessions as long as a named view is set with the formatting, if a default view is set up with conditional formatting it likely won't survive between sessions.

    Ken Slovak MVP - Outlook

    Wednesday, February 26, 2014 3:00 PM
    Moderator