Thursday, December 31, 2009

Finding Process ID for Debugging

If you do SharePoint development, you'll eventually need to debug SharePoint itself. You'll need to pick one of several w3wp.exe processes from the list. The question is which one?

The answer is a little VB script called iisapp.vbs.

Open a command window, type iisapp.vbs and you get a list like this:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>iisapp.vbs
W3WP.exe PID: 7800 AppPoolId: SharePoint Central Administration v3
W3WP.exe PID: 4428 AppPoolId: SharePoint - 80
W3WP.exe PID: 2872 AppPoolId: SharePoint_Pool
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>

The middle entry in this list shows the process ID you need.

Saturday, December 12, 2009

Deleting an InfoPath Form Template

If you work with InfoPath and SharePoint Forms Services, someday, you'll need to delete a form template. There's a catch: Deleting the form doesn't delete the content types created when the form was originally uploaded. This can be important.

When an InfoPath form template is uploaded to SharePoint using Central Administration, SharePoint creates a content type for the form. Published properties of the form are turned into site columns.

There are probably good reasons why this is true, but it can lead to situations where the form template appears to live on your site after you've deleted it. Here's one of them:
  1. Pick a set of properties to publish with your form, then publish the form to your SharePoint server using Central Administration.
  2. Use the form in a forms libary and take note that your properties are available in the library.
  3. Delete the lirbrary
  4. Delete the form template using Central Administration.
  5. Change the form's published properties and republish the form template.
  6. Use the form in a forms library.
  7. Note that the library columns are the old InfoPath properties, not the new ones. Its almost as if the ghost of the old InfoPath template lives on.

There are a couple of ways to deal with this. First, delete the content type and site columns that go with your form.

Second, and probably better, create and manage the site columns as a separate project. When you publish the form template, take care to connect the published properties to your content types.