Add-in first time run

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

Add-in first time run
 
Claudiu Bria




Posts: 6
Joined: 2012-06-20
Hi,

What would be the best way to know programmatically when the Add-in is run for the first time ? Any examples would be great. Thank you.

Best Regards,
Claudiu
Posted 22 Jan, 2013 01:38:55 Top
Andrei Smolin


Add-in Express team


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

You can create a custom registry key at startup. That is, if the key doesn't exist, this is the first start. Note that for a per-user add-in, you can create such a key as a subkey of the registry key provided by ADXAddinModule.RegistryKey; in this case, your key will be deleted when the add-in is uninstalled.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jan, 2013 01:59:16 Top
Claudiu Bria




Posts: 6
Joined: 2012-06-20
Hi Andrei,

May I ask for an example of that, please ? Also, is there any special consideration on specific scenarios like Win8/Office Version/x32bit/x64bit for this ?

We are working here on a neutral add-in that should work in the future on pretty much all hosts (Outook, Word, Excel, Access, quite all of them), but for the moment we started the implementation only for Outlook.

Thank you in advance,
Claudiu
Posted 22 Jan, 2013 02:38:50 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hi Claudiu,

No such sample exists. The above was just a suggestion, you are free to invent some other way to achieve this. As to using the registry, I don't see any difference whether you create it on this or that Windows version.

Hope you know that the key I'm talking about is your add-in's key, it is located in {HKLM or HKCU}\Software\Microsoft\Office\{Office application}\Addins\{your add-in}

HKLM - if your add-in is per-machine
HKCU - if your add-in is per-user

Creating your key (as described above) under your add-in's key leads to detecting the first start of a new add-in version as the first start, too. This is because the add-in's key is deleted when your add-in is uninstalled, this deletes your key, too.

You can bypass this by creating a separate key in HKCU; "separate" means "outside of the add-in's key". Nevertheless, this approach depends on the Office bitness in this scenario:
- you create this registry key on Windows 64bit + Office 32 bit; the key is written to the 32bit part of the registry because your add-in is 32 bit
- the user uninstalls Office 32bit and installs Office 64bit; your add-in is reinstalled, too
- the add-in doesn't find the registry key at startup because now it works with the 64bit part of the registry


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jan, 2013 03:53:44 Top