0

Im trying to follow this Microsoft tutorial to display the names of a distribution list in c#

https://learn.microsoft.com/en-us/office/client-developer/outlook/pia/how-to-get-members-of-an-exchange-distribution-list

This example prompts the user to select an Exchange distribution list from the Select Names dialog box and expands the distribution list to display its members.

except when I get an error here

enter image description here

I have this in a console app project. How can I fix this?

omega
  • 40,311
  • 81
  • 251
  • 474

1 Answers1

1

You can fix this by creating an Application instance, as per suggestion made by the prompt in your screenshot. Like so:

Application app = new Application();
Outlook.SelectNamesDialog snd = app.Session.GetSelectNamesDialog();

Sources:

  1. How to invoke a method with (Outlook.Application application) as parameter in C#?
Iliass Nassibane
  • 651
  • 7
  • 15