-1

I am a beginner in C# .net programming. The application I'm developing will generate a unique number and want to pass this value to the subject field in reply window of ms outlook.

I have tried using Microsoft.Office.Interop.Outlook to create a new mail but cant really get around to the reply from inbox, should an addin be used?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Prince
  • 3
  • 3
  • 1
    First of all show us what you have tried.! Stackoverflow is for solving problems, you don't have a concrete problem yet. http://stackoverflow.com/help/how-to-ask – JP..t Jun 15 '15 at 09:20

1 Answers1

0

Here you have an example of creating an email using outlook interop. You can set your int to the subject field see below.

 using Outlook = Microsoft.Office.Interop.Outlook;


 //Create the email with the settings
 Outlook.Application outlookApp = new Outlook.Application();
 Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
 mailItem.Subject = mailSubject;
 mailItem.Attachments.Add(totalPath);
 mailItem.Body = mailBody;
 mailItem.Importance = Outlook.OlImportance.olImportanceNormal;
 try
 {
     //Try to open outlook, set message if its not possible to open outlook
     mailItem.Display(true);
 }
 catch (Exception ex)
 {
     MessageBox.Show(ex.Message);
     return false;
 }
JP..t
  • 575
  • 1
  • 6
  • 28
  • Please mark this as 'answer' if it helped you! – JP..t Jun 15 '15 at 09:56
  • Thanks for the reply. But this is for creating new mail and have already tried this, I require this as a reply from inbox – Prince Jun 15 '15 at 10:07
  • Maybe you need this: http://stackoverflow.com/questions/16348403/how-to-reply-to-an-outlook-mailitem-using-net If this not works, you need to get the information for the reply mail and add it to the new mailitem. – JP..t Jun 15 '15 at 10:10
  • good suggestion, will give it a go – Prince Jun 15 '15 at 10:13