paradoxlost.com

paradoxlost development

Browsing Posts in Office

DSOFile .NET

No comments

So I’ve been working with mass archiving Office documents at work lately.  Part
of this process is extracting meta data information from the files such as subject
and author.  Microsoft has had a “sample” component out for a while to accomplish
this:  DSOFile
Using this component brings up COM Interop fun which I like to avoid if possible.

Having a bit of free time on my hands, I set about looking at rewriting DSOFile using
C++/CLI.  This actually turned out to be pretty easy once I figured out how msclr::com::ptr
worked and DSOFileNET was born.

Something that I happened upon this week after reading one-to-many post saying that
VSTO Add-ins can’t be installed for all users under Office 2007.  I knew it worked
that way under Office 2003, and they couldn’t have broken compatability that much
in ‘07.  I was determined to find a workable solution to this problem because
the sheer administrative overhead of needing each user to run the install or another
patch mechanism was rediculous.

First, I had to identify the major difference between ‘03 and ‘07 when dealing with
VSTO:  ‘07 supports it natively.  In ‘03 all VSTO Add-ins are loaded via
a generic shim and are essentially regular COM add-ins.  In ‘07 the add-ins are
loaded directly by the Office app, ignoring the shim.  To get around this issue,
you have to cause ‘07 to load your add-in the same way that ‘03 would:  as a
COM-shimmed add-in.  Invoking this behavior is a simple stroke of the delete
key.

Setup your installer as normal, except having all registry entries defined under HKLM
instead of HKCU.  Then navigate to HKLM/Software/Microsoft/Office/[APP]/Addins/[YourAddin]. 
Remove the “Manifest” value from this key.  This value being missing causes ‘07
to load your add-in via the ProgID [YourAddin], which eventually leads it to the VSTO
AddinLoader and your real add-in via the Manifest defined under your CLSID/[GUID]
entry.

There is a downside to this method:  If your add-in crashes, it will take out
all other add-in using the AddinLoader via Office’s disabled list.