title: How to get Application Data folder/Word template folder in Vista?
body: <p>Using WiX (Windows Installer XML) I have created an MSI installer which installs Word templates into the users Application Data folder, e.g. on Windows XP </p>
  
  <pre><code>C:\Documents and Settings\&lt;user&gt;\Application Data\Microsoft\Templates
  </code></pre>
  
  <p>I'm retrieving the path to this folder from the registry:</p>
  
  <pre><code>&lt;Property Id="APPDIR" Secure="yes"&gt;
      &lt;RegistrySearch Id="RegSearch_AppData" 
          Type="directory" 
          Key="Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"    
          Name="AppData" 
          Root="HKCU" /&gt;
  &lt;/Property&gt;
  
  &lt;CustomAction Id="ActionWordTemplateFolderAssign" 
                Property="TEMPLATEFOLDER" 
                Value="[APPDIR]Microsoft\Templates" /&gt; 
  
  &lt;InstallExecuteSequence&gt;
      &lt;Custom Action="ActionWordTemplateFolderAssign" Sequence="1" /&gt;
  &lt;/InstallExecuteSequence&gt;
  </code></pre>
  
  <p>However, some users installing the MSI file on Windows <strong>Vista</strong> receive an error because the <strong>APPDIR</strong> property is <strong>empty</strong>.</p>
  
  <p>Is APPDIR not the correct way to retrieve the Application Data folder? Or do I have to consider another property on Vista?  </p>
  
  <p>EDIT: This is just a short version of the WiX Code to retrieve Word's template folder. First I'm actually checking whether the user has a custom template folder defined by a policy or under HKCU\Software\Microsoft\Office\12.0\Common\General\UserTemplates. However, if none of these are set the fallback is to use the default location under %APPDATA%\Microsoft\Templates which is retrieved by the above code.</p>