<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SGriffin's MAPI Internals : MFCMAPI</title><link>http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx</link><description>Tags: MFCMAPI</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>November 2009 Release of MFCMAPI</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/11/17/november-2009-release-of-mfcmapi.aspx</link><pubDate>Tue, 17 Nov 2009 16:46:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9923666</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9923666.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9923666</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9923666</wfw:comment><description>&lt;p&gt;The November 2009 Release (build 6.0.0.1016) is live: &lt;a href="http://mfcmapi.codeplex.com"&gt;http://mfcmapi.codeplex.com&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;The September 2009 release was downloaded over 18 thousand times, with nearly 1700 of them being the 64 bit build. This exceeded the July build by about 4000 downloads. Yay MFCMAPI!&lt;/p&gt;  &lt;p&gt;Mostly bug fixes this time around. Win 7 finally made me dig into why Close All Windows wasn’t working, and I did a bit of work to make MFCMAPI a better multimon client.&lt;/p&gt;  &lt;p&gt;Here's a change list - see the &lt;a href="http://www.codeplex.com/MFCMAPI/WorkItem/List.aspx"&gt;Issue Tracker&lt;/a&gt; on Codeplex for more details, or look at the code:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Close All: Shutdown of contents table windows was swallowing the WM_CLOSE message for the other windows. Whoops! &lt;/li&gt;    &lt;li&gt;Multimon: New windows and context menus now show on the same screen as their parent window, as they should. &lt;/li&gt;    &lt;li&gt;Unicode Files: MFCMAPI can now handle files (like .msg or .eml files) that have Unicode characters in their names. &lt;/li&gt;    &lt;li&gt;Property Editor: It’s now possible to manually insert CR/LF characters directly in the hex stream of a property and write the exact data you intended, as long as you don’t touch the text editor. This is to work around a bug/feature of the rich edit control that made reproducing certain issues impossible. &lt;/li&gt;    &lt;li&gt;Smart View: Can now turn Smart View off if you’ve got a property that’s causing it to choke. Do continue to report these to me though! &lt;/li&gt;    &lt;li&gt;Version selection: Did some work to make it clearer when you’re running the wrong version of MFCMAPI (32/64) for the version of MAPI you have. &lt;/li&gt;    &lt;li&gt;Error Dialog Suppression: Identified a number of “error” dialogs that confused more than they helped and eliminated them. If there was an actual error it’s written to the debug output. &lt;/li&gt;    &lt;li&gt;Tons of minor issues – 22 total bugs tied to this release, and those are just the ones that were worth calling out. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Enjoy.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/11/17/november-2009-release-of-mfcmapi.aspx";digg_title = "November 2009 Release of MFCMAPI";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9923666" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>Where CDO Publishes Free Busy Information</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/11/16/where-cdo-publishes-free-busy-information.aspx</link><pubDate>Mon, 16 Nov 2009 14:05:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9922933</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9922933.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9922933</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9922933</wfw:comment><description>&lt;p&gt;From time to time, I get asked to explain where CDO publishes Free Busy information in the Public Folder store, so I figured I’d put this article together. The basic process CDO uses for updating FB information is outlined in the More Information section of &lt;a href="http://support.microsoft.com/kb/278954"&gt;KB 278954&lt;/a&gt;. We’re concerned with the part of the process summarized as “queued up to be sent to the site’s Free/Busy public folder.”&lt;/p&gt;  &lt;p&gt;The first thing CDO does is to open the Public Folder store and read a couple properties off of it, &lt;a href="http://msdn.microsoft.com/en-us/library/ms526844(EXCHG.10).aspx"&gt;PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID&lt;/a&gt; (0x66250102) and&amp;#160; &lt;a href="http://msdn.microsoft.com/en-us/library/ee160529.aspx"&gt;PR_SPLUS_FREE_BUSY_ENTRYID&lt;/a&gt; (0x66220102). These entry IDs will point at a couple folders in the Public Folder store. The first entry ID points the Free Busy folder for the user’s site, the folder CDO wants to look in for the Free Busy message. If CDO cannot open the folder specified by PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID, it turns to the second property, PR_SPLUS_FREE_BUSY_ENTRYID, which points at the “SCHEDULE+ FREE BUSY” folder, a child folder of the NON_IPM_SUBTREE folder. This property will point at the same folder for all users. In this case, CDO will use an algorithm similar to the one described in &lt;a href="http://msdn.microsoft.com/en-us/library/ee237796.aspx"&gt;[MS-OXOPFFB]&lt;/a&gt; to find the correct site folder for the Free Busy message.&lt;/p&gt;  &lt;p&gt;The point of failure here is the Entry ID specified in PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID. If this points at the wrong folder, CDO will publish Free Busy information to the wrong folder, and other clients won’t see the updated Free Busy. This property is not one that anybody sets. It’s actually computed on the server side. No amount of changes to a CDO based program can get it to publish Free Busy to the correct folder if the server is handing out the wrong site folder.&lt;/p&gt;  &lt;p&gt;This is where server side troubleshooing articles such as KB &lt;a href="http://support.microsoft.com/kb/326637"&gt;326637&lt;/a&gt; and &lt;a href="http://technet.microsoft.com/en-us/library/bb123804(EXCHG.65).aspx"&gt;Exchange Public Folder Troubleshooting Resources&lt;/a&gt; come in handy. They walk you through the various things that could be wrong with site folders and how to fix them. If PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID is pointing at the wrong folder for your users you’ll need to use the steps in those articles to locate the problem and fix it.&lt;/p&gt;  &lt;p&gt;Suppose you just want to determine if PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID is pointing at the folder you’d expect it to point to for a particular user. You can use &lt;a href="http://mfcmapi.codeplex.com/"&gt;MFCMAPI&lt;/a&gt; to see where this entry ID points to.&lt;/p&gt;  &lt;p&gt;First, we check which folders we’re being pointed at:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Open MFCMAPI on the machine where your CDO application runs.&lt;/li&gt;    &lt;li&gt;Log on to a profile. You’ll get your best results if you can use the same profile the CDO application uses.&lt;/li&gt;    &lt;li&gt;Select the Public Folder store in the list of stores.&lt;/li&gt;    &lt;li&gt;The properties we want may or may not show in the default list of properties, so we’ll add them:&lt;/li&gt;    &lt;ol&gt;     &lt;li&gt;Click Property Pane/Modify Extra Properties&lt;/li&gt;      &lt;li&gt;Click Add&lt;/li&gt;      &lt;li&gt;In the Property Tag field, type in PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID. The rest of the form should fill out automatically.&lt;/li&gt;      &lt;li&gt;Click OK, then click Add again.&lt;/li&gt;      &lt;li&gt;In the Property Tag field, type in PR_SPLUS_FREE_BUSY_ENTRYID. The rest of the form should fill out automatically.&lt;/li&gt;      &lt;li&gt;Click OK, then click OK again to close the Extra Properties window.&lt;/li&gt;   &lt;/ol&gt;    &lt;li&gt;We’ve added the properties, so they should show in the property pane. You can sort by the Property Name column and look them up by name, or sort by the Tag column and look them up by number (0x66250102 for PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID and 0x66220102 for PR_SPLUS_FREE_BUSY_ENTRYID.&lt;/li&gt;    &lt;li&gt;Right click on PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID and select Open as Entry ID or Object. In the dialog that comes up, hit OK.&lt;/li&gt;    &lt;li&gt;In the resulting hierarchy view, you can now read the name of the site folder the server has directed you to.&lt;/li&gt;    &lt;li&gt;Switch back to the main window and reselect the Public Folder store to refresh the property list.&lt;/li&gt;    &lt;li&gt;Right click on PR_SPLUS_FREE_BUSY_ENTRYID and select Open as Entry ID or Object. In the dialog that comes up, hit OK.&lt;/li&gt;    &lt;li&gt;This will display the hierarchy for the SCHEDULE+ FREE BUSY folder. Click the + icon to display the list of all the site folders in the Public Folder store.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Next, we determine which folders we should be looking at, following the algorithm from &lt;a href="http://msdn.microsoft.com/en-us/library/ee179045.aspx"&gt;[MS-OXOPFFB]:&lt;/a&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;In the main window of MFCMAPI, select Session/Display Current User Properties. Hit OK.&lt;/li&gt;    &lt;li&gt;In the Property Pane, locate PR_SEARCH_KEY (0x300B0102).&lt;/li&gt;    &lt;li&gt;Double-click on the property to open it, and take note of the Text field. For me, this says “EX:/O=MICROSOFT/OU=NORTHAMERICA/CN=RECIPIENTS/CN=420275”&lt;/li&gt;    &lt;li&gt;The appropriate site folder can be derived by truncating this string at the / before the first CN. So for me, my site folder should be “EX:/O=MICROSOFT/OU=NORTHAMERICA”.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;So, now you know what site folder the user has listed in PR_FREE_BUSY_FOR_LOCAL_SITE_ENTRYID, and you know the name of the site folder they should be using. If these two are not the same folder, then you have site folder issues and need to get them addressed.&lt;/p&gt;  &lt;p&gt;Hopefully, this should be enough to help folks who are having site folder issues to understand that CDO is just the innocent victim here when it publishes Free Busy to the wrong folder, and that server side configuration is the real villain.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/11/16/where-cdo-publishes-free-busy-information.aspx";digg_title = "Where CDO Publishes Free Busy Information";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9922933" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Exchange/default.aspx">Exchange</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Documentation/default.aspx">Documentation</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Public+Folders/default.aspx">Public Folders</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/CDO/default.aspx">CDO</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>Strange Looking NDR</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/11/12/strange-looking-ndr.aspx</link><pubDate>Thu, 12 Nov 2009 22:54:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9921617</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9921617.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9921617</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9921617</wfw:comment><description>&lt;p&gt;Not many people are aware of the feature, but &lt;a href="http://mfcmapi.codeplex.com/"&gt;MFCMAPI&lt;/a&gt; implements a &lt;a href="http://msdn.microsoft.com/en-us/library/cc815680.aspx"&gt;MAPI Form Viewer&lt;/a&gt;. This means MFCMAPI can use MAPI to ask Outlook to display messages. You might have run into this if you ever double-click on a message in MFCMAPI. If you’re on a machine with Outlook installed, the message will open up like it does when you double-click it in Outlook. And if Outlook isn’t installed and you’re using Exchange’s MAPI, you get a scary dialog saying we &lt;a href="http://blogs.msdn.com/stephen_griffin/archive/2009/07/08/exchange-mapi-and-the-form-manager.aspx"&gt;couldn’t open the MAPI form manager&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;This is one of those dark corners of MAPI into which few people tread, and most of those who do end up cribbing or parroting the Form Viewer implementation in MFCMAPI itself, meaning nearly every issue they report related to form viewers can be reproduced in MFCMAPI. Sometimes, this turns out to be a bug in my implementation, like an errant warning while &lt;a href="http://mfcmapi.codeplex.com/WorkItem/View.aspx?WorkItemId=9146"&gt;clicking up and down through messages&lt;/a&gt; (fix coming very soon!). Other times, the problem is a bug in Outlook.&lt;/p&gt;  &lt;p&gt;My latest customer’s issue turned out to be the latter case. They had noticed that when they tried to view NDR messages with their Form Viewer, the body of the message would be full of alien looking RTF text:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fcharset0 Consolas;}}     &lt;br /&gt;{\*\generator Riched20 12.0.6413.1000;}\viewkind4\uc1      &lt;br /&gt;\pard\fi-1440\li1440\tx1440\f0\fs21 Your message did not reach some or all of the intended recipients.\par      &lt;br /&gt;etc…”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;What was really odd was that if you looked at the message in MFCMAPI, this text was no where to be found! And to top it off – if you opened the message from Outlook, you got the NDR message you expected.&lt;/p&gt;  &lt;p&gt;So what was going on? It’s not surprising that Outlook builds the NDR text on the fly. It’s much easier to localize it that way. And the RTF does appear to be the underlying RTF we would generate for the NDR message. But why did we display it wrong, and why did Outlook display it right?&lt;/p&gt;  &lt;p&gt;The key here is the &lt;a href="http://msdn.microsoft.com/en-us/library/cc839522.aspx"&gt;LoadForm&lt;/a&gt; function. This function takes the message class of the form we want to load. Under the covers, LoadForm looks up the message class using &lt;a href="http://msdn.microsoft.com/en-us/library/cc842436.aspx"&gt;ResolveMessageClass&lt;/a&gt; and gets the GUID for the associated class factory. The form manager then passes this GUID over to Outlook and asks for the class factory. This is where we have a problem. Outlook uses the same GUID for multiple form class factories, some of which have different attributes associated with them. The class factory we get has an attribute on it stating it should render using HTML, while the class factory we should have gotten did not have this attribute. So when it comes time to render the text, we use the wrong rendering method and get the ugly RTF text.&lt;/p&gt;  &lt;p&gt;When Outlook opens the message, being the implementer of the forms, it gets to skip many of the MAPI steps. Instead of using the message class to look up a GUID, it uses the message class to look up the class factory directly, getting the right one in the process.&lt;/p&gt;  &lt;p&gt;Based on the fact that this behavior has been unchanged for as long as we can trace back, and we’re only just now hearing of an issue with it, we chose not to fix this problem, but instead document it. So – here’s the documentation. Enjoy!&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/11/12/strange-looking-ndr.aspx";digg_title = "Strange Looking NDR";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9921617" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Outlook/default.aspx">Outlook</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Documentation/default.aspx">Documentation</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>Announcing EWSEditor 1.5!</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/11/09/announcing-ewseditor-1-5.aspx</link><pubDate>Mon, 09 Nov 2009 20:18:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9919744</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9919744.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9919744</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9919744</wfw:comment><description>&lt;p&gt;Matt’s very excited about the &lt;a href="http://blogs.msdn.com/mstehle/archive/2009/11/09/announcing-ewseditor-1-5.aspx"&gt;release of EWSEditor&lt;/a&gt;. This tool does for &lt;a href="http://msdn.microsoft.com/en-us/library/dd633709.aspx"&gt;EWS&lt;/a&gt; what &lt;a href="http://mfcmapi.codeplex.com/"&gt;MFCMAPI&lt;/a&gt; does for MAPI. With this tool, Matt does what I did with MFCMAPI and what I recommend to anyone trying to learn a new API: the best way to learn an API is to write tools that use it.&lt;/p&gt;  &lt;p&gt;As you work with EWSEditor, you may notice a few things which are similar to MFCMAPI. This is no coincidence. EWS and MAPI, both designed primarily to interact with an Exchange server, share much of the same object hierarchy, which in turn dictates that tools designed to explore these hierarchies will be similar. Also, since we sit near each other and act as each other’s ad-hoc PMs, we borrow each other’s features. For instance, EWSEditor implements much of the same Smart View parsing as MFCMAPI, using the same logic, recoded from C++ to CSharp.&lt;/p&gt;  &lt;p&gt;Of course, there’s one similarity between EWSEditor and MFCMAPI that has nothing to do with the underlying APIs or fancy features and everything to do with the fact that Matt and I are programmers, not icon designers. Look familiar?&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="EWSEditor" border="0" alt="EWSEditor" src="http://blogs.msdn.com/blogfiles/stephen_griffin/WindowsLiveWriter/AnnouncingEWSEditor1.5_D756/EWSEditor2_3.png" width="36" height="36" /&gt;&lt;/p&gt;  &lt;p&gt;Enjoy! &lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/11/09/announcing-ewseditor-1-5.aspx";digg_title = "Announcing EWSEditor 1.5!";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9919744" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Exchange/default.aspx">Exchange</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/EWS/default.aspx">EWS</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>OpenStreamOnFile vs Unicode Files</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/09/29/openstreamonfile-vs-unicode-files.aspx</link><pubDate>Tue, 29 Sep 2009 18:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9900916</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9900916.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9900916</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9900916</wfw:comment><description>&lt;P&gt;Let’s take a look at the function &lt;A href="http://msdn.microsoft.com/en-us/library/cc765560(office.14).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc765560(office.14).aspx"&gt;OpenStreamOnFile&lt;/A&gt;, which is exported by MAPI. Suppose you want to use this function to open a stream on a file that has a Unicode file name. As has been &lt;A href="http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.messaging/2008-06/msg00086.html" mce_href="http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.messaging/2008-06/msg00086.html"&gt;noted&lt;/A&gt; before, this doesn’t work. Why is this? According to the documentation, and according to the header, maputil.h, this function takes two parameters, lpszFileName and lpszPrefix, which are of type LPCTSTR. However, it is impossible for an exported function to take a parameter of this type. Why? Because LPCTSTR is a macro that compiles to either LPCSTR or LPCWSTR depending on whether Unicode was defined in the project. But MAPI’s the same no matter how you compiled your project, so the export won’t change.&lt;/P&gt;
&lt;P&gt;In truth, OpenStreamOnFile should have been declared as taking parameters of type LPCSTR. We’re working on an update to the MSDN and to the &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=f8d01fc8-f7b5-4228-baa3-817488a66db1&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=f8d01fc8-f7b5-4228-baa3-817488a66db1&amp;amp;displaylang=en"&gt;MAPI Headers&lt;/A&gt; to fix that. We’ll also be documenting a new function, which you can go ahead and use to open files with Unicode names: OpenStreamOnFileW. This is the Unicode version of OpenStreamOnFile which takes Unicode strings. Here’s the signature:&lt;/P&gt;&lt;PRE style="BORDER-BOTTOM: #cecece 1px solid; BORDER-LEFT: #cecece 1px solid; PADDING-BOTTOM: 5px; BACKGROUND-COLOR: #fbfbfb; MIN-HEIGHT: 40px; PADDING-LEFT: 5px; WIDTH: 650px; PADDING-RIGHT: 5px; OVERFLOW: auto; BORDER-TOP: #cecece 1px solid; BORDER-RIGHT: #cecece 1px solid; PADDING-TOP: 5px"&gt;&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;STDMETHODIMP OpenStreamOnFileW(
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   LPALLOCATEBUFFER lpAllocateBuffer,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   LPFREEBUFFER lpFreeBuffer,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   ULONG ulFlags,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   __in LPCWSTR lpszFileName,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   __in_opt LPCWSTR lpszPrefix,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   LPSTREAM FAR * lppStream);
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;&lt;SPAN style="COLOR: #0000ff"&gt;typedef&lt;/SPAN&gt; HRESULT (STDMETHODCALLTYPE FAR * LPOPENSTREAMONFILEW) (
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   LPALLOCATEBUFFER lpAllocateBuffer,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   LPFREEBUFFER lpFreeBuffer,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   ULONG ulFlags,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   __in LPCWSTR lpszFileName,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   __in_opt LPCWSTR lpszPrefix,
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;   LPSTREAM FAR * lppStream);
&lt;/PRE&gt;
&lt;PRE style="BACKGROUND-COLOR: #fbfbfb; MARGIN: 0em; WIDTH: 100%; FONT-FAMILY: consolas,'Courier New',courier,monospace; FONT-SIZE: 12px"&gt;&lt;/PRE&gt;&lt;/PRE&gt;
&lt;P&gt;Other than the change to the strings, the function is identical to OpenStreamOnFile. Officially, we’re only documenting this function for Outlook 2010 and higher, but the function is also there in Outlook 2003 and 2007. The &lt;A href="http://www.microsoft.com/downloads/details.aspx?familyid=E17E7F31-079A-43A9-BFF2-0A110307611E&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?familyid=E17E7F31-079A-43A9-BFF2-0A110307611E&amp;amp;displaylang=en"&gt;Exchange MAPI Download&lt;/A&gt; does not implement OpenStreamOnFileW at all.&lt;/P&gt;
&lt;P&gt;The November build of MFCMAPI is being augmented to handle Unicode file names. Part of that rewrite is that MFCMAPI will use OpenStreamOnFileW if it’s available, and fall back to OpenStreamOnFile if it’s not.&lt;/P&gt;
&lt;P&gt;Enjoy!&lt;/P&gt;
&lt;DIV style="TEXT-ALIGN: right; PADDING-BOTTOM: 4px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 4px" class=wlWriterHeaderFooter&gt;
&lt;SCRIPT type=text/javascript&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/09/29/openstreamonfile-vs-unicode-files.aspx";digg_title = "OpenStreamOnFile vs Unicode Files";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/SCRIPT&gt;

&lt;SCRIPT type=text/javascript src="http://digg.com/tools/diggthis.js" mce_src="http://digg.com/tools/diggthis.js"&gt;&lt;/SCRIPT&gt;

&lt;SCRIPT type=text/javascript&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/SCRIPT&gt;
&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9900916" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Outlook/default.aspx">Outlook</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Documentation/default.aspx">Documentation</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>September 2009 Release of MFCMAPI</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/09/10/september-2009-release-of-mfcmapi.aspx</link><pubDate>Thu, 10 Sep 2009 23:48:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9893871</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9893871.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9893871</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9893871</wfw:comment><description>&lt;p&gt;The September 2009 Release (build 6.0.0.1015) is live: &lt;a href="http://mfcmapi.codeplex.com"&gt;http://mfcmapi.codeplex.com&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;The July 2009 release was downloaded over 13 thousand times, with nearly 1700 of them being the 64 bit build. This was the most popular release yet – retiring MAPI Editor drove a lot of traffic over to codeplex.&lt;/p&gt;  &lt;p&gt;I did a lot of work on the property and hex editors this time around. The property editor should be much better at editing large and complex streams you’ll find in PR_BODY or PR_RTF_COMPRESSED. And the Hex Editor is no longer modal! Now maybe &lt;a href="http://blogs.msdn.com/rickhall/"&gt;Rick&lt;/a&gt; will stop bugging me about it.&lt;/p&gt;  &lt;p&gt;Here's a change list - see the &lt;a href="http://www.codeplex.com/MFCMAPI/WorkItem/List.aspx"&gt;Issue Tracker&lt;/a&gt; on Codeplex for more details, or look at the code:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Ctrl+H will now bring up a non-modal Hex Editor&lt;/li&gt;    &lt;li&gt;That “Sample version” text is now gone. There is only one version of MFCMAPI, and it’s what you get on &lt;a href="http://mfcmapi.codeplex.com"&gt;codeplex&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Embedded NULLs in strings no longer break the property and stream editors&lt;/li&gt;    &lt;li&gt;All the editors (hex, property, stream) should be able to handle MUCH larger strings now&lt;/li&gt;    &lt;li&gt;Smart View: Added parsing for PR_ADDITIONAL_REN_ENTRYIDS, &lt;a href="http://msdn.microsoft.com/en-us/library/ee415119(office.14).aspx"&gt;dispidPropDefStream&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Smart View: Added framework for Smart View parsing of multivalued properties, and added a bunch of previously unparsed properties.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Enjoy.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/09/10/september-2009-release-of-mfcmapi.aspx";digg_title = "September 2009 Release of MFCMAPI";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9893871" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>Exchange 2010 and the MAPI Download</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/09/02/exchange-2010-and-the-mapi-download.aspx</link><pubDate>Wed, 02 Sep 2009 21:06:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9890508</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9890508.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9890508</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9890508</wfw:comment><description>&lt;p&gt;Bunches of people have contacted me asking if the MAPI download works with Exchange 2010. My usual response has been that I know it works, but you have to tweak the profile. I didn’t know the specific tweaks ‘cause I hadn’t looked in to it.&lt;/p&gt;  &lt;p&gt;Dave Vespa just &lt;a href="http://blogs.msdn.com/dvespa/archive/2009/09/02/how-to-configure-a-mapi-profile-to-connect-to-exchange-2010.aspx"&gt;blogged those tweaks&lt;/a&gt;. Note that they’re very similar to the modifications we use with Exchange 2007 to get referral working. Also note that the profile Dave builds is not referral enabled, but this doesn’t matter any more. With Exchange 2010, MAPI always talks to the Client Access Server for both mailbox and directory. The dreaded DSProxy that we were trying to avoid in 2007 and earlier has been replaced by the &lt;a href="http://microsoftblog.globalknowledge.com/2009/07/27/cas-role-matures-in-exchange-2010/"&gt;Address Book Service&lt;/a&gt;, which is pretty much what DSProxy should have been.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/09/02/exchange-2010-and-the-mapi-download.aspx";digg_title = "Exchange 2010 and the MAPI Download";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9890508" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Exchange/default.aspx">Exchange</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI+Download/default.aspx">MAPI Download</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>Outlook 2010 MAPI Reference Updated</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/08/31/outlook-2010-mapi-reference-updated.aspx</link><pubDate>Tue, 01 Sep 2009 00:01:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9889535</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9889535.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9889535</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9889535</wfw:comment><description>&lt;p&gt;The Outlook 2010 MAPI Reference has been updated. I don’t have a list of everything that changed, so I’ll highlight one addition that’s pretty cool: &lt;a href="http://msdn.microsoft.com/en-us/library/ee415110(office.14).aspx"&gt;the property definition stream&lt;/a&gt;. Long time readers might remember I mentioned this property before – it’s one of the properties you want to delete &lt;a href="http://blogs.msdn.com/stephen_griffin/archive/2005/12/29/new-outlook-documentation-part-5-one-off-forms.aspx"&gt;to kill a one-off form&lt;/a&gt;. It’s also the property that Outlook uses to store information about named properties created via the Object model and the user interface. &lt;/p&gt;  &lt;p&gt;Now that the format of &lt;a href="http://msdn.microsoft.com/en-us/library/ee415119(office.14).aspx"&gt;PidLidPropertyDefinitionStream&lt;/a&gt; is documented, you can create new user defined properties using MAPI and have them show up in the UI! The September release of MFCMAPI (which I’m furiously hammering on) will be able to parse this property.&lt;/p&gt;  &lt;p&gt;As usual, the documentation is also available for &lt;a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=5f61a276-9c09-4c82-9b80-20dccad17a2a"&gt;download&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/08/31/outlook-2010-mapi-reference-updated.aspx";digg_title = "Outlook 2010 MAPI Reference Updated";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9889535" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Outlook/default.aspx">Outlook</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Documentation/default.aspx">Documentation</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>July 2009 Release of MFCMAPI</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/07/16/july-2009-release-of-mfcmapi.aspx</link><pubDate>Thu, 16 Jul 2009 21:15:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9835905</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9835905.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9835905</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9835905</wfw:comment><description>&lt;p&gt;The July 2009 Release (build 6.0.0.1014) is live: &lt;a href="http://mfcmapi.codeplex.com"&gt;http://mfcmapi.codeplex.com&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Note that a 64 bit build is now included. Of course, to use it, you’ll need &lt;a href="http://blogs.msdn.com/stephen_griffin/archive/2009/07/13/enter-the-64-bit-mapi-dragon.aspx"&gt;64 bit Outlook 2010&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;This time around I focused on performance. I've just discovered the built in &lt;a href="http://blogs.msdn.com/profiler/"&gt;profiler&lt;/a&gt; in Visual Studio and I’ve been using it to find bottlenecks in loading items and displaying their properties. It’s been enlightening to drill into the performance reports and find out just how much time some of the code paths took to execute. I was able to trim away a good bit of fat.&lt;/p&gt;  &lt;p&gt;The biggest change I made in the name of performance was in the area of Named Properties. I found I was repeatedly calling &lt;a href="http://msdn.microsoft.com/en-us/library/cc765793(office.14).aspx"&gt;GetNamesFromIDs&lt;/a&gt; to map property tags to their named prop names. Cutting down the number of calls meant implementing a &lt;a href="http://mfcmapi.codeplex.com/WorkItem/View.aspx?WorkItemId=8036"&gt;cache&lt;/a&gt;. We still incur the initial hit to look up the mappings, but once we’ve looked up a tag, we won’t look it up again. Uncached profiles should load a bit faster now.&lt;/p&gt;  &lt;p&gt;Here's a change list - see the &lt;a href="http://www.codeplex.com/MFCMAPI/WorkItem/List.aspx"&gt;Issue Tracker&lt;/a&gt; on Codeplex for more details, or look at the code:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Fixed the tooltips on column headers to stop going away&lt;/li&gt;    &lt;li&gt;Added a “Count Named Properties” feature&lt;/li&gt;    &lt;li&gt;Numerous perf improvements&lt;/li&gt;    &lt;li&gt;Fixed compilation for VC6 and VS 2005 (see &lt;a href="http://mfcmapi.codeplex.com/WorkItem/View.aspx?WorkItemId=8038"&gt;my workaround&lt;/a&gt; for the “old DIB” issue)&lt;/li&gt;    &lt;li&gt;Found and fixed a few crashes&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Enjoy.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/07/16/july-2009-release-of-mfcmapi.aspx";digg_title = "July 2009 Release of MFCMAPI";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9835905" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>Enter the 64 Bit MAPI Dragon</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/07/13/enter-the-64-bit-mapi-dragon.aspx</link><pubDate>Mon, 13 Jul 2009 22:19:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9832159</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9832159.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9832159</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9832159</wfw:comment><description>&lt;p&gt;Up until today, the first rule of 64 bit MAPI was we don’t talk about 64 bit MAPI. But now we can talk about it. 64 bit MAPI has arrived!&lt;/p&gt;  &lt;p&gt;We just released the &lt;a href="http://msdn.microsoft.com/en-us/library/cc765775(office.14).aspx"&gt;Outlook 2010 MAPI Reference&lt;/a&gt; today. If you develop MAPI based applications, you’ll want to get the updated &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=f8d01fc8-f7b5-4228-baa3-817488a66db1&amp;amp;displaylang=en"&gt;MAPI Headers&lt;/a&gt; that come with it. You’ll need these if you want to rebuild your application for 64 bit. We’ve also prepared an article on &lt;a href="http://msdn.microsoft.com/en-us/library/dd941355(office.14).aspx"&gt;building MAPI applications for both 32 bit and 64 bit platforms&lt;/a&gt;. This article is based in part on my experience building MFCMAPI as a 64 bit application. Since we don’t provide a 64 bit mapi32.lib, to build a 64 bit MAPI application you’re going to have to use &lt;a href="http://msdn.microsoft.com/en-us/library/cc963763(office.14).aspx"&gt;explicit linking&lt;/a&gt;, building on the documentation we included in the Outlook 2007 MAPI reference.&lt;/p&gt;  &lt;p&gt;Oh yeah – that reminds me – &lt;a href="http://mfcmapi.codeplex.com"&gt;MFCMAPI&lt;/a&gt; builds as a 64 bit application! Actually, it’s been possible to build MFCMAPI as 64 bit for years. I slipped those project types in a long time ago and have been quietly maintaining them, even before I had an actual 64 bit build of MAPI I could test against. The next release of MFCMAPI will include a 64 bit build of the project, but if you want a 64 build now, just download the &lt;a href="http://mfcmapi.codeplex.com/SourceControl/ListDownloadableCommits.aspx"&gt;source&lt;/a&gt; and build it yourself.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/07/13/enter-the-64-bit-mapi-dragon.aspx";digg_title = "Enter the 64 Bit MAPI Dragon";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9832159" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Outlook/default.aspx">Outlook</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Documentation/default.aspx">Documentation</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>MFCMAPI and Old Versions of Visual Studio</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/07/09/mfcmapi-and-old-versions-of-visual-studio.aspx</link><pubDate>Fri, 10 Jul 2009 00:45:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9827684</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9827684.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9827684</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9827684</wfw:comment><description>&lt;p&gt;Ever since I went to the new &lt;a href="http://blogs.msdn.com/stephen_griffin/archive/2008/11/18/november-2008-release-of-mfcmapi.aspx"&gt;Vista style icon&lt;/a&gt; for MFCMAPI, it’s &lt;a href="http://mfcmapi.codeplex.com/Thread/View.aspx?ThreadId=46894"&gt;not been possible to compile in Visual Studio 6&lt;/a&gt;. I’ve spent some time looking at this, and it appears the only clean way to get VS 6 working again is to remove compression from the icon, something I really don’t want to do. So I’m considering dropping support for Visual Studio 6 altogether. While I’m at it, it’s been a while since I tried to compile in VS 2003 or 2005, so I was thinking about dropping support for those two as well. The only compiler I’d test would be Visual Studio 2008 (and 2010 whenever it comes out). Note that other than the known break in VS 6 I’m not planning on actively breaking compilation for 2003 or 2005. I just wouldn’t test them, so over time, I probably would break them.&lt;/p&gt;  &lt;p&gt;Before I do this – I wanted to get feedback. Would anybody care if MFCMAPI no longer compiled in Visual Studios 6, 2003, or 2005?&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/07/09/mfcmapi-and-old-versions-of-visual-studio.aspx";digg_title = "MFCMAPI and Old Versions of Visual Studio";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9827684" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Gotchas/default.aspx">Gotchas</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>Exchange MAPI and the Form Manager</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/07/08/exchange-mapi-and-the-form-manager.aspx</link><pubDate>Wed, 08 Jul 2009 18:27:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9824148</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9824148.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9824148</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9824148</wfw:comment><description>&lt;p&gt;Had a customer contact me recently asking why &lt;a href="http://msdn.microsoft.com/en-us/library/cc839517.aspx"&gt;MAPIOpenFormMgr&lt;/a&gt; doesn’t work with the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=E17E7F31-079A-43A9-BFF2-0A110307611E&amp;amp;displaylang=en"&gt;Exchange MAPI download&lt;/a&gt;. Actually, it wasn’t working in Exchange 2003 either. I’m not sure exactly when it last worked in Exchange’s implementation of MAPI. We might have to go all the way back to the &lt;a href="http://en.wikipedia.org/wiki/Microsoft_Exchange_Client"&gt;Exchange Client&lt;/a&gt; to find a version of Exchange’s MAPI where it worked.&lt;/p&gt;  &lt;p&gt;There was more to this story that I wanted to post. A few years ago, on a whim, I debugged why MAPIOpenFormMgr was broken. I found it was looking for a forms manager DLL that Exchange hadn’t shipped in a long long time. However, there was a mechanism for directing Exchange’s MAPI to use a different forms manager, and one of the DLLs Exchange shipped could act as a forms manager. Since this wasn’t likely supported, and no one was asking about it, I filed it away as an interesting tidbit.&lt;/p&gt;  &lt;p&gt;Since I did get asked about it, my plan was to post the reg key that controls which forms manager is used with a warning that since it isn’t supported or tested, it’s quite possible it will break on you. However, when I went to try it out, I found that when you try it out with the Exchange MAPI download, you crash right away. This isn’t surprising considering no one’s run the code in 10+ years.&lt;/p&gt;  &lt;p&gt;So there’s no point in posting the key, though someone who was really determined could figure it out pretty quickly, and with a little debugging even figure out which DLL to point at. I guess I’ll leave that as an exercise for the reader. The official answer here is that Exchange’s implementation of MAPI doesn’t include a functioning forms manager, so none of the forms management portions of MAPI, such as MAPIOpenFormMgr or &lt;a href="http://msdn.microsoft.com/en-us/library/cc765748.aspx"&gt;MAPIOpenLocalFormContainer&lt;/a&gt;, are available.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/07/08/exchange-mapi-and-the-form-manager.aspx";digg_title = "Exchange MAPI and the Form Manager";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9824148" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Exchange/default.aspx">Exchange</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Documentation/default.aspx">Documentation</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Gotchas/default.aspx">Gotchas</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI+Download/default.aspx">MAPI Download</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>So Long Mapi Editor…And Thanks For All The Fish</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/06/15/so-long-mapi-editor-and-thanks-for-all-the-fish.aspx</link><pubDate>Mon, 15 Jun 2009 16:44:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9753214</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9753214.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9753214</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9753214</wfw:comment><description>&lt;p&gt;I’ve touched on the history of MFCMAPI &lt;a href="http://blogs.msdn.com/stephen_griffin/archive/2008/01/04/a-brief-history-of-mfcmapi.aspx"&gt;before&lt;/a&gt;. The rebranding of MFCMAPI as MAPI Editor and posting it on the Microsoft Download site back in 2006 served a purpose, one for which at the time there were few alternatives. However, since then, I have taken back control over publishing of the tool so I can get updates and fixes to my users faster (as opposed to “never”, which was the case with that download).&lt;/p&gt;  &lt;p&gt;Since setting up the &lt;a href="http://mfcmapi.codeplex.com/"&gt;Codeplex&lt;/a&gt; site, one thing that’s been bugging me is that the “MAPI Editor” download was still fairly popular. No amount of evangelizing the new builds on the Codeplex site would prevent people from searching for MFCMAPI on Microsoft.com and coming up with what I view as an old and buggy build. So, last week, we “fixed the glitch”. If you visit the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=55FDFFD7-1878-4637-9808-1E21ABB3AE37&amp;amp;displaylang=en"&gt;download page&lt;/a&gt; now, instead of MAPI Editor, you’ll find a link to Codeplex. And if you download the file that’s there (apparently – there has to be a file to have a page on the download site), it’s a PDF that also directs you to Codeplex.&lt;/p&gt;  &lt;p&gt;The switch was flipped last Thursday, and my download stats already show a &lt;a href="http://mfcmapi.codeplex.com/stats"&gt;huge spike&lt;/a&gt;. So the redirection must be working! Hopefully now I’ll stop seeing problem reports on that old build.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/06/15/so-long-mapi-editor-and-thanks-for-all-the-fish.aspx";digg_title = "So Long Mapi Editor…And Thanks For All The Fish";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9753214" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>(Less Than) Portable Search Folders</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/05/21/less-than-portable-search-folders.aspx</link><pubDate>Thu, 21 May 2009 23:47:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9634298</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9634298.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9634298</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9634298</wfw:comment><description>&lt;p&gt;Let’s have fun with the object model and search folders:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Outlook running a profile in online mode. &lt;/li&gt;    &lt;li&gt;Create this macro:      &lt;p&gt;Sub TestAdvancedSearchComplete()&lt;/p&gt;      &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Dim sch As Outlook.Search&lt;/p&gt;      &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; set sch = Application.AdvancedSearch(&amp;quot;Inbox&amp;quot;, &amp;quot;urn:schemas-microsoft-com:office:office#Keywords like 'Test'&amp;quot;, True, &amp;quot;MySearchFolder&amp;quot;)&lt;/p&gt;      &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; sch.Save (&amp;quot;MySearchFolder&amp;quot;)&lt;/p&gt;      &lt;p&gt;End Sub&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;Run the macro, observe the folder. &lt;/li&gt;    &lt;li&gt;On the same machine, create a new profile in cached mode and start Outlook &lt;/li&gt;    &lt;li&gt;Run macro, get “Run-time error '-2147219964 (80040604)': Cannot create folder.” &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;If we want to have more fun, instead of running the macro the second time, we can locate the folder “&lt;em&gt;MySearchFolder”&lt;/em&gt; under the Search Folder node in Outlook. If we click on it, Outlook creates a search folder, but it doesn’t populate with the items we expect to find.&lt;/p&gt;  &lt;p&gt;What’s going on here? To answer that, we have to know a bit about how Outlook’s persisted search folder feature works. When you create a search folder, either using the Object Model, or directly in Outlook, the folder isn’t the first thing created. The first thing created is the search folder definition message. This is a message with the message class “IPM.Microsoft.WunderBar.SFInfo” which lives in the associated contents of the Common Views folder. We can use MFCMAPI to take a look at this message:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/stephen_griffin/WindowsLiveWriter/LessThanPortableSearchFolders_EC0A/SearchFolderDefinitionMessage_1.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Our search folder definition message from Common Views" border="0" alt="Our search folder definition message from Common Views" src="http://blogs.msdn.com/blogfiles/stephen_griffin/WindowsLiveWriter/LessThanPortableSearchFolders_EC0A/SearchFolderDefinitionMessage_thumb_1.jpg" width="742" height="203" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;And we can use MFCMAPI’s Smart View feature to parse the search folder definition stored in &lt;a href="http://msdn.microsoft.com/en-us/library/cc815685.aspx"&gt;PR_WB_SF_DEFINITION&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/stephen_griffin/WindowsLiveWriter/LessThanPortableSearchFolders_EC0A/SearchFolderDefinition_1.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="PR_WB_SF_DEFINITION, with parsing courtesy Smart View" border="0" alt="PR_WB_SF_DEFINITION, with parsing courtesy Smart View" src="http://blogs.msdn.com/blogfiles/stephen_griffin/WindowsLiveWriter/LessThanPortableSearchFolders_EC0A/SearchFolderDefinition_thumb_1.jpg" width="477" height="549" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;From this, we find that the search folder definition contains the restriction that will form the basis of the search folder:&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;Restriction:
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;lpRes-&amp;gt;rt = RES_CONTENT
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;lpRes-&amp;gt;res.resContent.ulFuzzyLevel = FL_IGNORECASE | FL_FULLSTRING = 0x00010000
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;lpRes-&amp;gt;res.resContent.ulPropTag = 0x8010101F (PT_MV_UNICODE)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;lpRes-&amp;gt;res.resContent.lpProp-&amp;gt;ulPropTag = 0x8010001F (PT_UNICODE)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;lpRes-&amp;gt;res.resContent.lpProp-&amp;gt;Value = Test
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;  Alt: cb: 8 lpb: 5400650073007400&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Note that this restriction includes a property in the 0x8000 range, meaning it’s a &lt;a href="http://msdn.microsoft.com/en-us/library/cc765864.aspx"&gt;named property&lt;/a&gt;. In fact, it’s &lt;a href="http://msdn.microsoft.com/en-us/library/cc842379.aspx"&gt;the named property “Keywords” in the PS_PUBLIC_STRINGS namespace&lt;/a&gt;. Note also that there’s nothing in the restriction which tells me this. I only know it because I created the search folder and I know what the search folder is supposed to be looking for.&lt;/p&gt;

&lt;p&gt;Now – what happens when we go to a different profile looking at the same mailbox? The search folder itself doesn’t get synched back to the server. Only this search folder definition message gets synced. When Outlook encounters this message, it places a dummy node under Search Folders and waits for the user to click on it. If the user does click on it, it builds the search folder using the information from PR_WB_SF_DEFINITION.&lt;/p&gt;

&lt;p&gt;And that’s where the problem comes in: &lt;a href="http://msdn.microsoft.com/en-us/library/cc839749.aspx"&gt;Named property mappings&lt;/a&gt; are store specific. A named property mapping that’s valid for one store will most likely be invalid for another store. When we switched to cached mode, we’re now working with the OST, not Exchange. Even if there happens to be an 0x8010101F property in this store, it’s not going to be the “Keywords” property. So when we clicked on the folder in Outlook, it created a search folder that searched for a bogus property.&lt;/p&gt;

&lt;p&gt;What happened when we ran the macro is even more interesting: Outlook looked at our search string and built a search folder definition message with the appropriate PR_WB_SF_DEFINITION. However, it couldn’t save the message because it already existed, with a different definition!&lt;/p&gt;

&lt;p&gt;Why don’t we have a problem when we create search folders directly in Outlook? The Outlook user interface severely restricts the kinds of restrictions you can set up. Because of that, Outlook is able to store the PR_WB_SF_DEFINITION in a different format (using SFST_FILTERSTREAM instead of SFST_MRES). That format is more flexible with named properties, but isn’t capable of storing the wide variety of restrictions that could be specified through the Outlook Object Model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Workaround&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We did look at taking a fix for this, but the limitations of SFST_FILTERSTREAM eliminated it as a possibility for a fix. And the fact that this problem only happens if the restriction contains a named property (IE it won’t repro on a search for subject or recipients) limited the scope of the problem.&lt;/p&gt;

&lt;p&gt;However, for the case where the search folder is being created by a macro and we’re getting the “Cannot create folder” error, we found a neat workaround. We can use Outlook’s &lt;a href="http://msdn.microsoft.com/en-us/library/bb176395.aspx"&gt;PropertyAccessor&lt;/a&gt; to delete the search folder definition message so it can be recreated. Here’s a sketch of the code:&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;Sub DeleteSFItem()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Dim CommonViewsEIDBin As String
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Dim CommonViewsEIDString As String
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Dim CommonViewsFolder As Folder
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Dim ACTable As Table
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Dim oRow As Row
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Dim SFDefinitionEID As String
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Dim SFDefinitionItem As StorageItem
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    CommonViewsEID = Session.DefaultStore.PropertyAccessor.GetProperty( _
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &amp;quot;&lt;span style="color: #8b0000"&gt;http://schemas.microsoft.com/mapi/proptag/0x35E60102&lt;/span&gt;&amp;quot;)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    CommonViewsEIDString = Session.DefaultStore.PropertyAccessor.BinaryToString( _
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        CommonViewsEID)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Set CommonViewsFolder = Session.GetFolderFromID(CommonViewsEIDString)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Set ACTable = CommonViewsFolder.GetTable( _
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        &amp;quot;&lt;span style="color: #8b0000"&gt;[Subject] = 'MySearchFolder'&lt;/span&gt;&amp;quot;, olHiddenItems)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    Set oRow = ACTable.GetNextRow()
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    If (Not (oRow Is Nothing)) Then
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        SFDefinitionEID = oRow(&amp;quot;&lt;span style="color: #8b0000"&gt;EntryID&lt;/span&gt;&amp;quot;)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        Set SFDefinitionItem = Session.GetItemFromID(SFDefinitionEID)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;        SFDefinitionItem.Delete
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;    End If
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;End Sub
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;For further reading on the inner workings of search folder definition messages, check out the Exchange Protocol Doc &lt;a href="http://msdn.microsoft.com/en-us/library/cc433476.aspx"&gt;[MS-OSOSRCH]&lt;/a&gt;.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/05/21/less-than-portable-search-folders.aspx";digg_title = "(Less Than) Portable Search Folders";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9634298" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Outlook/default.aspx">Outlook</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Code+Snippet/default.aspx">Code Snippet</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Gotchas/default.aspx">Gotchas</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/OOM/default.aspx">OOM</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Protocol+Docs/default.aspx">Protocol Docs</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item><item><title>May 2009 Release of MFCMAPI</title><link>http://blogs.msdn.com/stephen_griffin/archive/2009/05/20/may-2009-release-of-mfcmapi.aspx</link><pubDate>Wed, 20 May 2009 17:26:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9632261</guid><dc:creator>Stephen Griffin</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/stephen_griffin/comments/9632261.aspx</comments><wfw:commentRss>http://blogs.msdn.com/stephen_griffin/commentrss.aspx?PostID=9632261</wfw:commentRss><wfw:comment>http://blogs.msdn.com/stephen_griffin/rsscomments.aspx?PostID=9632261</wfw:comment><description>&lt;p&gt;The May 2009 Release (build 6.0.0.1013) is live: &lt;a href="http://mfcmapi.codeplex.com"&gt;http://mfcmapi.codeplex.com&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The coolest new feature has to be the addition of Smart View parsing to the Hex Editor. I actually had the idea to do this the morning I published the March 2009 release, but didn’t want to delay that release any longer. One side effect of exposing the parsing in the Hex Editor is I was able to do much better testing of the existing parsing engine and fix a bunch of memory leaks and crashes.&lt;/p&gt;  &lt;p&gt;Here's a change list - see the &lt;a href="http://www.codeplex.com/MFCMAPI/WorkItem/List.aspx"&gt;Issue Tracker&lt;/a&gt; on Codeplex for more details, or look at the code:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Added ability to copy attachments from one message to another&lt;/li&gt;    &lt;li&gt;Added Outlook version feature - uses MSI to retrieve installed version of Outlook&lt;/li&gt;    &lt;li&gt;Added Smart View to hex editor&lt;/li&gt;    &lt;li&gt;Fixed issue converting MAPI to MIME from an MSG file&lt;/li&gt;    &lt;li&gt;Fixed parsing of fuzzy level flags&lt;/li&gt;    &lt;li&gt;Updated MAPI headers&lt;/li&gt;    &lt;li&gt;Removed extraneous pointer address output from restriction parsing&lt;/li&gt;    &lt;li&gt;Added smart view parsing for Entry Lists, Properties, Restrictions, and Search Folder Definitions&lt;/li&gt;    &lt;li&gt;Cleaned up memory leaks and crashes in smart view parsing&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Enjoy.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:right; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;script type="text/javascript"&gt;digg_url = "http://blogs.msdn.com/stephen_griffin/archive/2009/05/20/may-2009-release-of-mfcmapi.aspx";digg_title = "May 2009 Release of MFCMAPI";digg_bgcolor = "#FFFFFF";digg_skin = "compact";&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9632261" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MAPI/default.aspx">MAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/MFCMAPI/default.aspx">MFCMAPI</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/Protocol+Docs/default.aspx">Protocol Docs</category><category domain="http://blogs.msdn.com/stephen_griffin/archive/tags/DevMsgTeam/default.aspx">DevMsgTeam</category></item></channel></rss>