Cannot locate Microsoft.Office.Interop.Outlook Reference

192 views Asked by At

I have been tasked to convert an Outlook Distribution list to a CSV file. I have seen some examples online but I can’t find the COM reference. Question:

  1. Do I need to have Office installed to find the reference?
  2. Does a subscription to Office 365 work as well?

I’m developing this project with VS 2022, and .NET 6

Thank you!

1

There are 1 answers

0
Eugene Astafiev On

First of all, there are several ways to get get distribution list members. If you deal with Exchange profiles only you may consider using EWS, see Expanding a distribution list by using the EWS Managed API 2.0 for more information.

Another possible option is Graph API. Distribution lists are actually represented by the group entity in Microsoft Graph, so in your case you should be able to use the id returned from your people search in the following to get the group/DLs members

GET https://graph.microsoft.com/v1.0/groups/{id}/members

You could just search for your DL by filtering on the group entity:

GET https://graph.microsoft.com/v1.0/groups?$filter=displayName eq 'DL_NAME'

The people API is really about people that you communicate with most often - and it includes users, groups and contacts.

Both EWS and Graph API don't require installing anything on the end-user machine and can be used from the server-side or service software.

The last option is automating Outlook. In that case you need to install the desktop editions of Outlook to get a COM server registered for the application. As soon as COM server is registered you can add an Outlook COM reference.

Does a subscription to Office 365 work as well?

Yes, if it allows installing Outlook on your machine.