**Ultimate Goal/Frame Challenge:**

I'm trying to append the user's name and e-mail address to a template e-mail before sending it.

**Approach**

I'd like to use the DisplayName and SmtpAddress properties of the first Account in the Outlook.Application.Session.Accounts collection using the below code. The e-mail template does appear, but the error occurs when I try to append the text:

```
var outlook = new Microsoft.Office.Interop.Outlook.Application();

MailItem mailItem = outlook.CreateItemFromTemplate(TemplateEmail.FullName) as MailItem;
mailItem.Display();

mailItem.HTMLBody += (
    "For questions regarding this submission, please contact " + 
    outlook.Session.Accounts[0].DisplayName + " at " + outlook.Session.Accounts[0].SmtpAddress
);

mailItem.Send();

```

**Runtime error - not a compile error, Intellisense does like the properties**

> 
> error CS1061: 'Application' does not contain a definition for 'Session'
> 
> 
> 

**What I've tried**

1. Close all open files in my solution
2. Get the latest Outlook.Interop via Nuget, Microsoft signed
3. Remove the older Outlook.Interop reference
4. Save and close Visual Studio
5. Delete my bin and obj folders and my solution's .suo file
6. Restart my computer
7. Re-open the project in Visual Studio
8. Build --> Clean solution; Build --> Rebuild solution;

**Outlook.Application properties at the time of the error**

```
{Microsoft.Office.Interop.Outlook.ApplicationClass}
    AnswerWizard: '((Microsoft.Office.Interop.Outlook.ApplicationClass)outlook).AnswerWizard' threw an exception of type 'System.Runtime.InteropServices.COMException'
    Application: {Microsoft.Office.Interop.Outlook.ApplicationClass}
    Assistance: {System.__ComObject}
    Assistant: {System.__ComObject}
    COMAddIns: {System.__ComObject}
    Class: olApplication
    DefaultProfileName: "Outlook"
    Explorers: {Microsoft.Office.Interop.Outlook.ExplorersClass}
    FeatureInstall: msoFeatureInstallOnDemand
    Inspectors: {Microsoft.Office.Interop.Outlook.InspectorsClass}
    IsTrusted: false
    LanguageSettings: {System.__ComObject}
    Name: "Outlook"
    Parent: null
    PickerDialog: {System.__ComObject}
    Reminders: {Microsoft.Office.Interop.Outlook.RemindersClass}
    Session: {Microsoft.Office.Interop.Outlook.NameSpaceClass}
    TimeZones: {Microsoft.Office.Interop.Outlook.TimeZonesClass}
    Version: "16.0.0.14326"

```

I'm using 64-bit Outlook 365 on 64-bit Windows 10 for a 64 bit C# application.

---

Follow up question:
[C# class instance displays property values but does not allow direct referral](https://stackoverflow.com/questions/73216339/c-sharp-class-instance-displays-property-values-but-does-not-allow-direct-referr)