title: Lotus notes get attachment names from document
body: <p>I'm developing an Lotus Notes plug-in for Notes 8.5.2 that saves the attachments from an eMail to the Harddisk. But when I try to read the attachment names from a Notes document I always get the same string containing the first attachment name + some junk data.</p>
  
  <pre><code>protected Vector&lt;String&gt; getAttachmentNames() throws NotesException,
          IOException {
      Vector&lt;String&gt; attachmentNames = new Vector&lt;String&gt;();
      Item item = null;
      Enumeration&lt;?&gt; itemsEnum = mailDoc.getItems().elements();
      while (itemsEnum.hasMoreElements()) {
          item = (Item) itemsEnum.nextElement();
          if (item.getType() == Item.ATTACHMENT) {
              attachmentNames.add(getAttachmentNameOf(item));
          }
      }
      return attachmentNames;
  }
  
  protected String getAttachmentNameOf(Item item) throws NotesException,
          IOException {
      return getAttachmentName(item.getValueString());
  }
  </code></pre>
  
  <p>getAttachmentName only does some string formatting to generate a unique filename.</p>