Monday, June 1, 2015

Dress up your Content Type

Most SharePoint users understand the benefits of Content Types.   I'm not here to evangelize content types, explain why they’re beneficial or how to use them (whew!)  That being said, I do think they are underutilized, misunderstood and need permission to step out and attend the next gala event wearing their finest formal attire.  So I'm going to share one of my favorite tricks (and let's be honest, it’s not really a trick) that allows us to dress up our content types! 

Let's imagine you have a list with a few content types defined.  SharePoint provides the new, edit and display forms for each content type by default - which really makes our lives easy.  But did you ever notice that when you edit an item in a list with multiple content types the first choice field on the form is 'Content Type'?  What if you don't WANT the end user to be able to change the content type when editing?  I’m sure you’ve experienced that at least once.  Perhaps changing the Content Type would really screw up a running workflow.  Or maybe it just causes the end users confusion because they don't know what it means (I myself have been down both of those roads more than once).

With a little SharePoint Designer know how, you can easily create, modify and effect a new 'Edit' form for all (or just certain) content types without the annoying 'Content Type' choice requirement.  Here's how!

  1. Create or choose your list with content types enabled and defined.
  2. Create (at least) one list item using the content type you’ll be creating an ‘Edit’ form for.
  3. Edit the Item and notice the  pesky ‘Content Type’ choice:
  4. Open SharePoint Designer and navigate to the appropriate list
  5. In the forms section, choose "New"
    • In the ‘Create New list Form’ dialog window, enter a form ‘file name’ (RelFormType1EditForm.aspx). 
    • Select the form to create as 'Edit Item'
    • Select the appropriate 'Content Type' for the form to be based on.
    • Click ‘OK’ and SharePoint will create a new form you can edit.
  6. Go to the ‘Forms’ section again and find the new form.    
  7. Optionally double click to open and edit the form.  I’ve added a ‘row’ to my form that says “This is the ‘customized’ Edit form used only for the RelFormType1 Content Type’.  Maybe you’d want to include a form name or simple instructions – it's a form - so whatever makes sense.

  8. Save the form, keep designer open and go to next step.

  9. Navigate to the SharePoint site and edit one of the appropriate content type items (see step 1).  You’ll notice that nothing special happened after going through all that trouble of creating a form – don’t worry, it wasn’t for naught!

  10. Now, here’s the trick that’s not really a trick.  Go back to SharePoint designer (I assume you are still at the appropriate list).  Find the ‘Content Types’ section and click on the appropriate Content Type.

  11. At the ‘Content Types’ interface, find the ‘Forms’ section.  Update the ‘Edit Form’ URL using the relative URL of the form you just created for that content type (see step 6):
  12. Go to the SharePoint site and edit one of the existing items for this Content Type items (see step 1).  This time you will see your new form (in its formal attire!) with no pesky ‘Content Type’ field.

Even though the pesky ‘Content Type’ field is not visible on the ‘New’ and ‘Display’ default forms for Content Types, you can use the same set of instructions to create ‘customized’ versions of those forms as well. 


by Kelly Meyer via Everyone's Blog Posts - SharePoint Community

No comments:

Post a Comment