0

I am trying to compile my C# program into a Program.exe.

I am using method which is mentioned in this post "POST Reference"

The program uses "Microsoft.Office.Interop.Outlook" object and during compiling CMD it gives the following error. (Microsoft.Office.Interop Post Reference)

Error ScreenShot

And This is the Code

Code Image

and I tried adding the object in Project reference Outlook Object Ref

In the error it described that there is a missing argument in "Microsoft.Office.Interop.Outlook"

Need help on this issue.

Thanks for reading.

Sach
  • 10,091
  • 8
  • 47
  • 84
Paras P.
  • 1
  • 1

2 Answers2

0

Did you added the reference

Microsoft.Office

After add the reference

Microsoft.Office.Interop.Outlook ?

Temoxa
  • 11
  • 1
  • Yup I searched and added this two thing "Microsoft Office" & "Microsoft Outlook" in the project references. @Temoxa – Paras P. Jul 22 '19 at 18:35
  • This is what i am assuming based on your comment @temoxa. CODE: "using System; using System.Diagnostics; using System.IO; using Outlook = Microsoft.Office.Interop.Outlook; using Microsoft.Office;" ERROR: "Compilation failed: 2 error(s), 0 warnings main.cs(7,17): error CS0234: The type or namespace name `Office' does not exist in the namespace `Microsoft'. Are you missing an assembly reference? main.cs(6,27): error CS0234: The type or namespace name `Office' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?" – Paras P. Jul 22 '19 at 19:02
0

The C# app automates Outlook (CSAutomateOutlook) sample application shows how to automate Outlook from external applications. You may review the source code and find differences in project references. If it doesn't help, I'd suggest repairing Office selecting .net programmability support in the installation wizard.

Please remember, the Click2Run edition of Office 2010 doesn't support automation. See Office 2010 Click-to-Run compatibility with add-ins for more information. Also, you may find the How to: Verify Whether Outlook Is a Click-to-Run Application on a Computer article.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45