Need assistance deploying native (c++) Outlook add-in - outlook

I'm looking for Outlook 2007+ add-in deployment assistance. To deploy on a Win7 x64 and Office 2013 x64 machine, I added the registry keys from my Visual Studio 2013 native COM Outlook add-in project (.rgs file) and then copied the add-in library to the add-in directory on the client machine. Outlook is not loading the add-in on launch. Trying to load the library manually using the COM add-in dialog invokes an error ' like c:\Users\505hpc6z06\appdata\Roaming\Microsoft\AddIns\MyAddin.dll is not a valid Office add-in'.
These are the registry keys I added (not in wow64 registry node). In place of %MODULE% , I put the absolute path of the MyAddin.dll. something like c:\Users\505hpc6z06\appdata\Roaming\Microsoft\AddIns\MyAddin.dll
HKCR
{
NoRemove CLSID
{
ForceRemove {EB824C19-380D-417E-A9E2-28E77B2F3026} = s 'CompReg Class'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
TypeLib = s '{B0A51D8E-5E5A-447B-B935-765F3BC5C79F}'
Version = s '1.0'
}
}
}
HKCU
{
NoRemove Software
{
NoRemove Microsoft
{
NoRemove Office
{
NoRemove Outlook
{
NoRemove Addins
{
FromCloud.Connect
{
val Description = s 'My Outlook Addin'
val LoadBehavior = d 3
}
}
}
}
}
}
}
This is not a VSTO or .NET project/add-in. How can I deploy a native COM Outlook add-in to a client machine (win7, win8, win10, Outlook 2007+)?

Your unmanaged (c++) add-in needs to be compiled as 64-bit to be usable in Office 64-bit. Simply speaking, a 64-bit program cannot use 32-bit dll.
Does not matter what you write to the rigistry, 64-bit outlook will not load 32-bit COM addin. See similar question here: Using 32bit COM addin under MS Office 64 bit

Related

Outlook Add-in - How to get Outlook email item Sensitivity using Microsoft tools

I am developing an Outlook Add-in using TypeScript Angular. I have observed a difference between Outlook add-ins behavior i.e. while opening sensitive mails, add-ins disabled automatically in MAC but in Windows still able to access.
Outlook Add-in disabled on MAC
Outlook Add-in enabled on Windows
Environment: Outlook on Windows vs Outlook on Mac
I have gone through Microsoft document but still unable to get sufficient information related to mail sensitivity.
I have tried installing preview version but when I do forward/reply all with existing sensitive email I am not getting the sensitivity information.
Below is my code snippet:
Office.context.mailbox.item.sensitivity.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
console.log("Sensitivity: " + asyncResult.value);
} else {
console.log("Failed to get sensitivity: " +
JSON.stringify(asyncResult.error));
}
});
Note: The above code snippet will work only for Appointment as per the document.
Expected:
I have to disable few actions in my Outlook add-in when we are opening sensitive mails. Can you please suggest how to achieve sensitive mail information through any tool.
The Sensitivity property is available on Windows (for the Microsoft 365 subscription) only in the Outlook add-in API preview requirement set.

the connected state of the office add-ins registered in hkey_local_machine cannot be changed WIX

am using a wix installer to create an MSI package. While i try to install my outlook addin to everyone (allusers), it gets installed properly in the administrator, but it is not visible in other user group logins,
while i tried to manually enable the addin from the Options-> Addins, i get the below error
"the connected state of the office add-ins registered in hkey_local_machine cannot be changed".
i am using adxloader.
Is there something am missing in the installer ? my code for all users are below
"
Property Id="ALLUSERS" Value="1"
RegistryKey Action="createAndRemoveOnUninstall" Root="HKLM" Key="SOFTWARE\Microsoft\Office\Outlook\Addins\xxxxx.AddinModule">
Condition>USER_PROFILE="ALLUSERS" /Condition>
"
What is the version of the targeted office?
Add In registration for Office 2007 is different to Office 2010 and 2013.
For Office 2007, check out http://msdn.microsoft.com/en-us/library/bb206739%28v=office.12%29.aspx

Deploying a Outlook 2007 Addin created from Visual Studio 2010 for All Users

I'm trying to deploy a Outlook 2007 addin for all users in windows 7. I developed the addin using visual studio 2010 to simply to show a message box on load.
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
MessageBox.Show("test addin");
}
Since it is stated that creating a installer using Publish(ClickOnce) feature will not install the addin to all users, i tried creating an MSI setup project following the steps given in,
http://msdn.microsoft.com/en-us/library/ff937654.aspx#Create
Since I'm targeting only Outlook 2007, I executed only the steps up to configuring the registry.
Once I created the setup and installed it (selecting Everyone), the addin does not run initially in outlook. when I checked it in Trust Center, I could see my addin listed in the Inactive Application Addins Section.
Once I checked in the system registry(using regedit), all the Registry Key are properly included under HKEY_LOCAL_MACHINE as well.
(When I install it Selecting Only me, the addin works fine.)
Can anyone please help me to get this working for all users.
Thanks.
There is a second part to the tutorial which shows how to handle trust as part of the installation. You can find it here.

How to determine if VSTO 2010 Runtime is Installed?

It was easy to check if VSTO 2005 SE was installed by just calling MsiGetProductInfo() with the product code {388E4B09-3E71-4649-8921-F44A3A2954A7}, as listed in MSDN.
What is the product code for the VSTO 2010/4.0 runtime? Or is there a better way to determine if it's already installed? This is for our installation process.
Also, I am trying to figure out the same for Windows Imaging Component.
Unfortunately the answers here so far do not quite cover all the bases.
Product Code
This does not appear to be reliable - we're looking for a minimum version, not a specific version. Though the product code is in theory only supposed to change for major version increments, the version of VSTO on my machine - 10.0.40303 - has a product code of {A0FE0292-D3BE-3447-80F2-72E032A54875}. This suggests that Microsoft isn't necessarily keeping them stable, so I'd suggest this is not a good option.
File version
Another option may be to check for the presence / version of the VSTO assemblies themselves, which may typically be in %PROGRAM FILES%\Common Files\Microsoft Shared\VSTO\10.0. However I'd say this directory is not guaranteed - the actual directory appears to be specified in the registry, but obviously this solution is now no better than just getting the version from the registry directly...
Registry
So going by the registry is probably the only option left.
Unfortunately, the VSTO runtime version can appear in any one of 4 registry locations:
HKLM\SOFTWARE\Microsoft\VSTO Runtime Setup\v4 (32-bit, VSTO installed from Office 2010 installation)
HKLM\SOFTWARE\Microsoft\VSTO Runtime Setup\v4R (32-bit, VSTO installed from redistributable)
HKLM\SOFTWARE\Wow6432Node\Microsoft\VSTO Runtime Setup\v4 (64-bit, VSTO installed from Office 2010 installation)
HKLM\SOFTWARE\Wow6432Node\Microsoft\VSTO Runtime Setup\v4R (64-bit, VSTO installed from redistributable)
Note: I don't have a definitive source for this - I'm cobbling together bits of information from, for example, this blog post by Wouter van Vugt and this SO answer. There may be even more to it than that.
In addition, there may be minimum version requirements, though I suspect that in practice this is only going to affect people running pre-release versions of Office 2010:
The Visual Studio 2010 Tools for Office runtime also ships with
Microsoft Office 2010. However at the time of Office 2010 RTM, the
runtime with Office only supports Office solutions that target the
.NET Framework 3.5. If your solution targets the .NET Framework 3.5,
it can run either if Office 2010 is installed or if the Visual Studio
2010 Tools for Office Runtime redistributable is installed. If your
Office solutions target the .NET Framework 4, you must redistribute
the Visual Studio 2010 Tools for Office runtime (citation).
The easiest way is to check the registry.
HKLM\Microsoft\vsto runtime setup\v4\Install
HKLM\Microsoft\vsto runtime setup\v4R\VSTORFeature_CLR40 (this is for the 4.0 Office extensions)
The safest and cleanest method is still checking the product codes, here they are:
For VSTO 2010 x86, version 10.0.31124: {41A01180-D9FD-3428-9FD6-749F4C637CBF}
For VSTO 2010 x64, version 10.0.31124: {C3600AE6-93A0-3DB7-B7AA-45BD58F133B5}
I got them by extraction the contents of the following packages with 7-Zip and analyzing the MSIs with Orca:
http://download.microsoft.com/download/F/3/9/F395E3C2-28A0-4F0D-9E20-FF4D1ADB08D8/vstor40_x86.exe
http://download.microsoft.com/download/F/3/9/F395E3C2-28A0-4F0D-9E20-FF4D1ADB08D8/vstor40_x64.exe
They keys vary by the OS you are installing to. I painstakingly installed the standalone vsto and office 2010 and 2013 .exe's in x86 and x64.
In order to use the registry to check if vsto is installed, you need to verify the existence of the following keys:
for x64:
HKLM\SOFTWARE\Wow6432Node\Microsoft\VSTO Runtime Setup\v4 -> Install
HKLM\SOFTWARE\Wow6432Node\Microsoft\VSTO Runtime Setup\v4 -> ProductCode
for x86:
HKLM\SOFTWARE\Microsoft\VSTO Runtime Setup -> InstallerPath
Edit: What I actually ended up doing, was verify that the v4 folder exists.
I needed a way of detecting this when deploying Vstor as an application in SCCM 2012. I used the following PowerShell script to retrieve the info from WMI.
If the version is 10.0.50908, output is generated. SCCM considers detection to be successful if the detection script returns any value.
$VstorVersion = Get-WmiObject -Query "select ProductVersion from SMS_InstalledSoftware where ARPDisplayName = 'Microsoft Visual Studio 2010 Tools for Office Runtime (x64)'" -NameSpace "root\cimv2\sms"
if ($VstorVersion.ProductVersion -ge '10.0.50908') {Write-Host "Found"}
Here code.
In public method we determine is VSTO installed from Office or VSTO runtime package.
In private method, check if version is equals or bigger than version VSTO2010
public static bool CheckVSTO2010 ( ) {
string regFragment = IntPtr.Size == 8 ? "\\Wow6432Node\\" : "\\";
string regVSTO = string.Format( #"SOFTWARE{0}Microsoft\VSTO Runtime Setup\", regFragment );
return CheckVSTOVersion( regVSTO + "v4\\" ) || CheckVSTOVersion( regVSTO + "v4R\\" );
}
private static bool CheckVSTOVersion ( string keyPath ) {
using (var key = Registry.LocalMachine.OpenSubKey( keyPath )) {
//Not installed
if (key == null) {
return false;
}
var releaseKey = key.GetValue( "Version" );
if (releaseKey != null && !string.IsNullOrEmpty( releaseKey.ToString() )) {
var version = new Version( releaseKey.ToString() );
return version.Major >= 10 && version.Build >= 40820;
}
}
return false;
}

FInding the path where Visual Studio is Installed

I need help as to how I can find the path where Microsoft visual Studio is installed. I need to use that path in my program. What is the function that has to be called to get the path where Microsoft Visual Studio is installed ?
Depending on the app, it's probably best to ask the user, but here's some C# code that should do the trick for VS2008.
RegistryKey regKey = Registry.LocalMachine.OpenSubKey(#"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS");
string vsInstallationPath = regKey.GetValue("ProductDir").ToString();
regKey.Close();
It is probably possible to find it by searching the registry, but as I wanted a solution for build scripts I have been using environment variables to do this.
N.B. The name of the environment variable to query is version specific.
For VS2005 you can use VS80COMNTOOLS
For VS2008 you can use VS90COMNTOOLS
If you type SET VS90COMNTOOLS at a command prompt you should see:
VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\
so go up two folders to get to the root of the install path.
This is the quickest way to know the folder where VS is installed or any other program.
Open VS code and when it is running; open the Windows Task Manager and navigate to the Details tab.
Right-click on the Code.exe application that should be running by now and choose the option to Open File Location:
Windows Task Manager > Details Tab > RIGHTCLICK Code.exe > Open File Location
From the registry, HKLM\Software\Microsoft\VisualStudio\9.0\InstallDir for Visual Studio 2008
Is this for an add-in of some sort for Visual Studio?
Because otherwise, you need to be aware that someone running your program may not actually have Visual Studio installed.
If it is installed, you can generally find it at a known location in the registry, such as HKCR/Applications/devenv.exe/shell/edit/command for VS2008.
For newer versions of VS it is better to use from Microsoft provided APIs, because install information is no longer maintained in registry correctly.
install Nuget package Microsoft.VisualStudio.Setup.Configuration.Native
do the trick (returned is tuple with version and path of all VS instances):
private const int REGDB_E_CLASSNOTREG = unchecked((int)0x80040154);
public static IEnumerable<(string, string)> GetVisualStudioInstallPaths()
{
var result = new List<(string, string)>();
try
{
var query = new SetupConfiguration() as ISetupConfiguration2;
var e = query.EnumAllInstances();
int fetched;
var instances = new ISetupInstance[1];
do
{
e.Next(1, instances, out fetched);
if (fetched > 0)
{
var instance2 = (ISetupInstance2)instances[0];
result.Add((instance2.GetInstallationVersion(), instance2.GetInstallationPath()));
}
}
while (fetched > 0);
}
catch (COMException ex) when (ex.HResult == REGDB_E_CLASSNOTREG)
{
}
catch (Exception)
{
}
return result;
}
Regards

Resources