What is a DIP? Document Information Panel. It is nothing but an Infopath form.
As I've blogged about earlier, you can author custom DIPs as infopath forms to work with SharePoint/Office applications.
Now, infopath 2007 also supports a code-behind model, i.e. you can write managed code to introduce additional logic behind your infopath form. You can do stuff that infopath rules/actions etc. won't let you do. The issue is, how the heck do you debug it?
Assuming that you are authoring a DIP using the steps I described earlier, you can break into the code by hitting ALT_F_12 in the Infopath form. By default, this will create a project at
C:\Documents and Settings\<userid>\My Documents\InfoPath Projects
You can change this location, and the default language used by going to Tools --> Options --> Design tab.
The VSTA editor that ships with infopath, won't let you debug the code, because it won't let you attach to, say, Winword.exe. What you need to do is,
- Open that project in VS2005/8 professional or better.
- Attach the DIP to a content type, and author a new document, this invokes the DIP, and should attempt to attach the Infopath form.
- But this is where the catch 22 comes in.
Chances are, if like me, you are developing on a non-domain MOSS install, you will need to change your infopath form to Full Trust, so it can access resources such as the .Host property, or an external database. Office 2007 apps however will not let you run the forms in Full Trust. To fix this,
- Create a self signed cert using makecert.exe.
- Add it to your dev. machine's root cert collection.
- Sign the infopath form with that self created cert.
- Republish this new infopath form as the DIP for the given document content type.
- Debug happily ever after.