Skip to content

SharePoint Document Libraries and Not Showing the New Form

In SharePoint every content type can have three forms that you can define: New, Display, and Edit. These are the forms that are used to enter and view properties. This is great, except that document libraries don’t display the new form. Document libraries are designed to launch the template associated with the content type. If you’ve got your letterhead in a .dot file that’s associated with a content type, that is what SharePoint will launch when you try to create a new item. That’s great when you’re looking to create a new instance of a document – but what if you want the new instance of the document to be programmatically created?

The simple — and should be obvious — answer is to set the document template to the web part that will create your new item. When declaring the document template you’ll need to remember to put a leading slash in the url in the DocumentTemplate node’s TargetName attribute since for some unknown reason it’s required.

Help Your SharePoint User

Why would I do this? Well, I want to record approvals as XML documents with XML fields over it to allow SharePoint to use property promotion to extract information from the approval into properties that can be in a list view. Putting this together I can handle the details of the approval and just emit the XML I need at the end.

One issue is that this won’t pop over the page like the new item form will over a list – but it’s a good way to get a new form for a document – instead of a template.

P.S. If InfoPath supported password fields I probably wouldn’t have to do this.


  1. Quick question Robert. When you say “set the document template to the web part” do you mean the page hosting the webpart or the web part itself?

  2. I mean on the content type.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this: