title: Set custom document properties with Word interop
body: <p>I want to set some custom document properties of a word document I'm creating in my C# code. To do this, I followed <a href="http://msdn.microsoft.com/en-us/library/4e0tda25.aspx" rel="nofollow">this MSDN article</a> and came up with this code:</p>
  
  <pre class="lang-cs prettyprint-override"><code>using Word = Microsoft.Office.Interop.Word; // Version 12.0.0.0
  word = new Word.Application();
  word.Visible = false;
  Word._Document doc = word.Documents.Add(ref missing, ref missing, ref missing, ref missing);
  logger.Info("Setting document properties");
  Core.DocumentProperties properties = (Core.DocumentProperties)doc.BuiltInDocumentProperties;
  properties["Codice_documento"].Value = args[3];
  properties["Versione_documento"].Value = args[4];
  </code></pre>
  
  <p>Unfortunately, I get this error whenever it reaches the code:</p>
  
  <blockquote>
    <p>HRESULT: 0x80004002 (E_NOINTERFACE)</p>
  </blockquote>
  
  <p>Why is that? I used the interfaces exactly as described my MSDN, why doesn't it work?</p>
  
  <p>I'm using Interop for office 2010 and .net 3.5</p>