title: .NET Outlook Add-in: attaching a sent email item to a journal entry
body: <p>So I'm developing an outlook add-in that basically gathers some info from the user in the form, then sends a properly formatted email to the right person. What I want to do is then make a journal entry noting that the email had been sent, and attach the email in reference.</p>
  
  <p>To accomplish this manually, I can go to the "Sent Items" folder, and simply drag the email of choice down over the Journal icon in the bottom-left menu, and this accomplishes what I'm trying to do programmatically.</p>
  
  <p>Here is the code I'm using once the mail is sent:</p>
  
  <pre><code>Private Sub Application_ItemSend(ByVal Item As Object, ByRef Cancel As Boolean) Handles Application.ItemSend
      Cancel = False
      Dim sent As Outlook.MailItem = CType(Item, Outlook.MailItem)
      Dim app As New Outlook.Application
  
      Dim journal As Outlook.JournalItem = app.CreateItem(Outlook.OlItemType.olJournalItem)
      journal.Subject = sent.Subject &amp; " - " &amp; df.TextBox1.Text
      journal.Type = "E-mail Message"
      journal.Start = Now()
      journal.Duration = 0
      journal.Body = "Request sent to " &amp; df.ComboBox4.SelectedItem.ToString()
  
  
      Try
          journal.Attachments.Add(sent, Outlook.OlAttachmentType.olByReference)
          journal.Save()
      Catch ex As Exception
          MessageBox.Show(ex.Message)
      End Try
      df.Close()
  End Sub
  </code></pre>
  
  <p>Its getting hung up at Attachments.Add and my error message is "an object could not be found". I'm guessing it means 'sent' is no good. However, I use sent.Subject to title the journal entry, and I do not get an error there. Any thoughts?</p>
  
  <p>Your help is greatly valued!</p>