olApp = GetObject(, "Outlook.Application") will not find my Outlook started by Visual Studio

Add-in Express™ Support Service
That's what is more important than anything else

olApp = GetObject(, "Outlook.Application") will not find my Outlook started by Visual Studio
The instance of Outlook, started by VS is not available 
petgre




Posts: 48
Joined: 2014-04-29
I have two projects
The first is the Outlook project, adding features according to the need of the CRM system, like search, add appoinments etc. Everything works as it should and it is in production whith some 2000 users.

The second is the CRM system.

Earlier, I could start Outook from VB project, to be able to debug and see what is happening.
Then open the other project, who will communicate with the first project.

Both are Visual Studio (VB) projects.

Now, I cant create an instance of

olApp = GetObject(, "Outlook.Application"), it will fail, and therefore open a new Outlook.
Sometimes gives me a message saying that only one instance of Outlook can be opened.

This method of working has always been working before, but not now
Why cant I grab the outlook started by my project

Is it a Winwdows (10) Office (2016) problem
Are using the latest version 9 of add in express standard.

Thanks in advance

//Peter

info :

Microsoft Visual Studio Professional 2017
Version 15.5.2
VisualStudio.15.Release/15.5.2+27130.2010
Microsoft .NET Framework
Version 4.7.02556

Installed Version: Professional

Visual Basic 2017 00369-60000-00001-AA744
Microsoft Visual Basic 2017

Visual C# 2017 00369-60000-00001-AA744
Microsoft Visual C# 2017

Add-in Express for Microsoft Office and .NET v9.0.4610

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Designer for Visual Studio WiX Setup Projects 1.8.206

Insert C1 MVC Control Extension 1.0
Insert C1 MVC Control Extension

NuGet Package Manager 4.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

WiX Toolset Visual Studio Extension 0.9.21.62588
WiX Toolset Visual Studio Extension version 0.9.21.62588
Copyright © .NET Foundation and contributors. All rights reserved.
Posted 01 Jun, 2018 03:47:58 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello petgre,

Your code started elevated (if VS is started via "run as administrator") cannot know about Outlook started non-elevated; similarly, your code started non-elevated cannot know about Outlook started elevated. This is by Windows design.


Andrei Smolin
Add-in Express Team Leader
Posted 01 Jun, 2018 04:10:34 Top
petgre




Posts: 48
Joined: 2014-04-29
Ok, normally I run Outlook project as admin to be able to build, and the other project as non admin
Does not work
Tested to start the other project as admin to, does not work
Tested to start outlook project as non admin and the same with the other project = WORKS

Thanks a lot Andrei!

//Peter
Posted 01 Jun, 2018 04:17:12 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello Peter,

petgre writes:
Ok, normally I run Outlook project as admin to be able to build, and the other project as non admin Does not work


This shouldn't work; see my previous message.

petgre writes:
Tested to start the other project as admin to, does not work


I expected this to work.

petgre writes:
Tested to start outlook project as non admin and the same with the other project = WORKS


This is expected.


Andrei Smolin
Add-in Express Team Leader
Posted 01 Jun, 2018 04:29:57 Top