73

I am developing an application which will send emails using C#. The app will be able to use templates for mail, among other things. The problem is I'm having trouble finding any Office.Interop references, which means I cannot work with Outlook.

Office is installed on my computer, but I've also tried to install the PIA from this link http://www.microsoft.com/en-us/download/details.aspx?id=3508. Unfortunately, this didn't change anything: When I launch the MSI it stops without a word, and I don't know if that is part of the problem.

Kjartan
  • 18,591
  • 15
  • 71
  • 96
T2o
  • 915
  • 1
  • 7
  • 10

10 Answers10

101

Look for them under COM when trying to add the references. You should find the reference below, and possibly Microsoft Outlook 15.0 Object Library, if you need that. There are similar libraries for Word, Excel, etc.:

enter image description here

Update: The Object Library should contain the Interop stuff. Try to add this to a source file and see if it can now find what you need:

using Microsoft.Office.Interop.Outlook;

enter image description here

Kjartan
  • 18,591
  • 15
  • 71
  • 96
  • Yeah but it is the problem, I found Outlook 14.0 object library, but not the interops – T2o Feb 24 '14 at 11:37
  • 2
    Seems to me these are they are the same thing; see my update. Description is `Microsoft Outlook Object Library`, but the name is `Microsoft.Office.Interop.Outlook`. I think the library contains the Interop stuff - just add it, then try to add a Using-statement in your code, and see if it finds what you need. – Kjartan Feb 24 '14 at 11:55
  • 2
    So many thank's ! It was it, the Outlook Object Library, but I didn't have checked it ! But without you i'd never find I think :) – T2o Feb 24 '14 at 12:03
  • 1
    COM is located under Project > Add References – Blexy May 14 '15 at 23:10
  • 1
    Nice. Works for Visual Studio 2017 as well. – Francesco B. Apr 03 '18 at 15:44
  • 1
    I could add the `Microsoft Outlook Object Library` from References -> COM -> Type libraries, but I'd get an error when with the line `using Microsoft.Office.Interop.Outlook;` However, just searching in NuGet for 'Microsoft.Office.Interop.Outlook' gave me the ability to add the package. – reubonwry May 06 '20 at 07:15
29

I forgot to select Microsoft Office Developer Tools for installation initially. In my case Visual Studio Professional 2013 and also 2015.

enter image description here

Matthew Lock
  • 13,144
  • 12
  • 92
  • 130
24

If you're using Visual Studio 2015 and you're encountering this problem, you can install MS Office Developer Tools for VS2015 here.

Phileo99
  • 5,581
  • 2
  • 46
  • 54
  • 1
    The link doesn't go to the Office DevTools fpr VS2015 anymore. Tried to edit it but my suggestion was rejected, so here is the direct link (had to find it on a MS blog post...) : https://aka.ms/GetLatestOfficeDevTools – Michaël Polla Nov 14 '18 at 09:18
14

With Visual Studio 2015 I have activated it with the following steps.

  1. Programs and Features --> Select Visual Studio > Change
  2. Choose Modify
  3. Windows and Webdevelopment --> Tick/select "Microsoft Office Developer Tools"
  4. Start Update

It should work now.

Kjartan
  • 18,591
  • 15
  • 71
  • 96
LuckyLikey
  • 3,504
  • 1
  • 31
  • 54
12

You can find it at link:

C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Word\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Word.dll

Browse it then add references

Tung Ha
  • 141
  • 2
  • 7
  • 3
    @Jeff Ahh, I see, though calling a file a link, and being very vague on what to do with it still doesn't make this a very good answer, especially to a question nearly 2.5 years old – CDspace Oct 07 '16 at 04:16
  • Thanks for comment but i think it is a best answers because it goes straight to the point and save much time for people experiencing similar problems – Tung Ha Oct 14 '16 at 06:33
  • I wouldn't prefere the usage of a linked assembly over directly including it in the solution. Especially since these dependencies are not necessary the same on every developer machine. Also it might depend on different office installations. – LuckyLikey May 20 '19 at 05:11
3

If you have installed latest Visual studio and want to To locate library of Microsoft.Office.Interop.Outlook or any other Microsoft.Office.Interop library then you should look into below 2 folders:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office14

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15

Please note that folder could be C:\Program Files\

Manos Nikolaidis
  • 21,608
  • 12
  • 74
  • 82
Amit
  • 61
  • 5
2

I think you need to run that .msi to install the dlls. After I ran that .msi I can go to (VS 2012) Add References > Assemblies > Extensions and all of the Microsoft.Office.Interop dlls are there.

On my computer the dlls are found in "c:\Program Files(x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA" so you could check in a similar/equivalent directory on yours just to make sure they're not there?

John Darvill
  • 1,274
  • 11
  • 17
  • 1
    I searched and no I cannot find a directory. But perhaps the msi doesn't work ? So I downloaded again the exe, un zip it an launch the msi, but it's the same, the install stops when the progress bar is in the middle and without a word. Is it how it's supposed to work ? – T2o Feb 24 '14 at 11:54
  • Well there is no message at the end to suggest that the install has worked.. so yeah, maybe it did work for you? Can you definitely not see the Microsoft.Office.Interop.* assemblies under Asseumblies > Extensions in the Reference Manager? – John Darvill Feb 24 '14 at 12:07
0

You need to install Visual Studio Tools for Office Runtime Redistributable:

http://msdn.microsoft.com/en-us/library/ms178739.aspx

Oscar
  • 13,594
  • 8
  • 47
  • 75
0

I had the same issue with Visual Studio Community 2013, I fixed it downloading and installing the latest update of Office Developer Tools for Visual Studio 2013. Now I am able to see the whole Microsoft.Office.Interop.* list when I go to

Add References > Assemblies > Extensions

you can download it from here:

https://www.visualstudio.com/en-us/news/vs2013-update4-rtm-vs.aspx#Office
http://aka.ms/OfficeDevToolsForVS2013

Ajay2707
  • 5,690
  • 6
  • 40
  • 58
joseluiscc
  • 234
  • 2
  • 5
  • This has prerequisite: VS 2013 **Professional**! – Jettero Feb 19 '16 at 14:24
  • With a freshly installed laptop (only Win7, Office 2013 and VStudio 2013 Community) I've just installed Developer Tools for VStudio 2013 (August 2015 update) and finally I can find PIA directory under C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office. – EAmez Mar 21 '16 at 16:27
0

Just doing like @Kjartan.

Steps are as follows:

  1. Right click your C# project name in Visual Studio's "Solution Explorer";

  2. Then, select "add -> Reference -> COM -> Type Libraries " in order;

  3. Find the "Microsoft Office 16.0 Object Library", and add it to reference (Note: the version number may vary with the OFFICE you have installed);

  4. After doing this, you will see "Microsoft.Office.Interop.Word" under the "Reference" item in your project.