title: Outlook 2016 Signature and Active Directory
body: <p>I have this script which creates an outlook signature and looks over to Active Directory for date (DisplayName, Telephone, and Title).</p>
  
  <p>I have this line of code to copy a .docx file to appdata and save it in html, rtf, and txt. </p>
  
  <pre><code>#Save new message signature 
  Write-Output "Saving signatures"
  #Save HTML
  $saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat], "wdFormatHTML");
  $path = $LocalSignaturePath+'\'+$SignatureName+".htm"
  $MSWord.ActiveDocument.saveas([ref]$path, [ref]$saveFormat)
  
  #Save RTF 
  $saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat], "wdFormatRTF");
  $path = $LocalSignaturePath+'\'+$SignatureName+".rtf"
  $MSWord.ActiveDocument.SaveAs([ref] $path, [ref]$saveFormat)
  
  #Save TXT    
  $saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat], "wdFormatText");
  $path = $LocalSignaturePath+'\'+$SignatureName+".txt"
  $MSWord.ActiveDocument.SaveAs([ref] $path, [ref]$SaveFormat)
  $MSWord.ActiveDocument.Close()
  $MSWord.Quit()
  </code></pre>
  
  <p>It works fine for Outlook 2013. But when I ran it for Outlook 2016, I get the following error</p>
  
  <pre><code>Unable to find type [Microsoft.Office.Interop.Word.WdSaveFormat].
  At C:\Users\rob\Downloads\set_outlook_signature\set_outlook_signature.ps1:142 char:1
  + $saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveForm ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (Microsoft.Offic...rd.WdSaveFormat:TypeName) [], RuntimeException
      + FullyQualifiedErrorId : TypeNotFound
  
  [ref] cannot be applied to a variable that does not exist.
  At C:\Users\rob\Downloads\set_outlook_signature\set_outlook_signature.ps1:144 char:1
  + $MSWord.ActiveDocument.saveas([ref]$path, [ref]$saveFormat)
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (saveFormat:VariablePath) [], RuntimeException
      + FullyQualifiedErrorId : NonExistingVariableReference
  
  Unable to find type [Microsoft.Office.Interop.Word.WdSaveFormat].
  At C:\Users\rob\Downloads\set_outlook_signature\set_outlook_signature.ps1:147 char:1
  + $saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveForm ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (Microsoft.Offic...rd.WdSaveFormat:TypeName) [], RuntimeException
      + FullyQualifiedErrorId : TypeNotFound
  
  [ref] cannot be applied to a variable that does not exist.
  At C:\Users\rob\Downloads\set_outlook_signature\set_outlook_signature.ps1:149 char:1
  + $MSWord.ActiveDocument.SaveAs([ref] $path, [ref]$saveFormat)
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (saveFormat:VariablePath) [], RuntimeException
      + FullyQualifiedErrorId : NonExistingVariableReference
  
  Unable to find type [Microsoft.Office.Interop.Word.WdSaveFormat].
  At C:\Users\rob\Downloads\set_outlook_signature\set_outlook_signature.ps1:152 char:1
  + $saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveForm ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (Microsoft.Offic...rd.WdSaveFormat:TypeName) [], RuntimeException
      + FullyQualifiedErrorId : TypeNotFound
  
  [ref] cannot be applied to a variable that does not exist.
  At C:\Users\rob\Downloads\set_outlook_signature\set_outlook_signature.ps1:154 char:1
  + $MSWord.ActiveDocument.SaveAs([ref] $path, [ref]$SaveFormat)
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (SaveFormat:VariablePath) [], RuntimeException
      + FullyQualifiedErrorId : NonExistingVariableReference
  </code></pre>
  
  <p>Is there a different formating for Outlook 2016. Thoughts?</p>
  
  <p>Thanks!</p>