While trying to set up a facility in SharePoint to email around summaries of the week's top news stories, I ran into a strange problem.
If you've read my previous post, you'll recall that I had set up a sub-site in SharePoint to hold the news articles - each article was on a new page and the pages incorporated metadata stored in Content Types created for that purpose.
I'd built the pages that way so that the non-technical News publishers would be able to set vital meta-data for each story without having to go the
Site Actions > View all Site Content > Pages
route to get to the Edit Properties function.
All that went fairly smoothly - apart from a small glitch around retrieving the current Page URL (see the previous Blog posting) - and we proudly launched our new News facility.
The next glitch came when one of the publishers was compiling the weekly round up of top News stories. I'd made a page containing a DVWP which looked at the Pages folder that contained all the News stories and displayed just those where a value for "weekly roundup email position" had been set. This is a Content Type that contains a choice of values "1st story, 2nd story, etc". The publisher creates a new story, then selects a value for "weekly roundup position" from a pick list. If the story isn't required in the weekly round up then they leave the value as "Select a position for email". The Content Type had the same value set as the default value.
The issue was, when the publisher created a new story, the value for "weekly roundup position" was blank by default. Where was the default value?
|Above left is what the metadata setting looked like when a new page was created, but we needed it to look like the above right image, with a default value displayed in the Roundup picklist.|
Everything looked like it was set up correctly but it wasn't working ... so had a trawl around on Google and was unable to find anyone else with the same problem. Then I chanced on a site where someone was talking about not seeing default values on Content types. After following a series of links and putting the information together, it became apparent to me what was causing the problem. Turns out you have to make the group of Content Types the Default Content Type Group for the List you're looking at.
So here's what I did ...
I had set up my new Content Types in the Article Page group. So I drilled down to the Content Type and made sure the default value was set to what I wanted.
Next I went back to the List - in this case, the Pages Directory that held the News articles - and from the Settings menu selected Document Library Settings.
Then I found the Content Types section - note that the Page Content Type is set as the default - and clicked on the link Change new button order and default content type.
Now it's not screamingly obvious but what you have to do is bring the Content Type Group that holds the Content Types you want to display the Default Values for up to the top of the list by setting its value to "1", then clicking OK.
That's it. The Content Types section should now look like this, with Articles at the top and ticked as the Default Content Type.
Now when you create a new page, the default values you set in the Content types will be added to the metadata for that page, unless (or until) you choose a different Content Type value.
Hope this helps someone ...