Thursday, February 19, 2009

Copy content types Across Farms (SharePoint)

Content Types in SharePoint can be very useful, and can be created by manually by users or automatically by various products or procedures. In one case, content types may be created automatically during a migration of content from CMS to SharePoint MOSS 2007 publishing server. Regardless of where they came from, they can be copied from one site to another, even moved across farms.

Under most circumstances, Gary Lapointe's stsadm extensions can be used to help automate the process. He has operations for copying content types between sites in the same farm, for propogating content types and for exporting content types from a site. Strangely there is no import content types, which would have enabled cross-farm content type copying.

To copy content types across farms, you'll need to do the gl-exportcontenttypes and then create a SharePoint feature that adds them to your site collection, site, ... whatever. If you don't want to install Gary Lapointe's stsadm extensions, you'll need to use his source code to write a console application that does the same thing. If you have the console application, you can drop it onto your source server (no install needed) and do the export.

For the export, I used the following flags:
url = http://hostname
contentTypeGroup = "Custom Content Types"
contentTypeName = null
excludeParentFields = false
includeFieldDefinitions = true
includeListBindings = false
listName = null
removeEncodedSpaces = false
featureSafe = true
outputFile = "ctypes.xml"

Once I had my output (ctypes.xml), I had to remove any ... tag pairs. For some reason they were included in some of the field definitions (site columns) associated with the exported content types. I don't know what the ultimate effect of this is, but it didn't matter to me in this case, and it worked without it.

The structure of the ctypes.xml file should look like this (values removed):
<elements xmlns="http://schemas.microsoft.com/sharepoint/">
<field id=" Name="" sourceid=" StaticName="" group=" RowOrdinal="" type=" DisplayName="" readonly=" Sealed="" colname=" PITarget="" piattribute=" /">
[...]
<contenttype id=" Name="" group=" Version="">
<folder targetname=" /">
<fieldrefs>
<fieldref id=" Name="">
<fieldref id=" Name="">
</fieldrefs></contenttype></elements>

Create a 12 hive feature directory:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\MyCtypes

Copy the ctypes.xml file into the directory.

Add feature.xml with content like this (with a new Id GUID, and change Scope if desired, remember Scope="Site" means SiteCollection):
<?xml version="1.0" encoding="utf-8"?>
<feature id="031D991D-2559-4512-BE86-024E9CA035B3"
Title="My Imported content types"
Description="Content types imported from wherever"
Version="1.0.0.0"
Scope="Site"
ImageUrl="Health.GIF"
Hidden="FALSE"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">
<elementmanifests>
<elementmanifest location="ctypes.xml">
</elementmanifests>
</feature>

Install the feature this way:
"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe" -o installfeature -name MyCtypes

(if your xml file doesn't comply to proper schema, this installfeature will fail)

Now go activeate the feature. In this case, go to "Site Collection Features" and click activate for the new feature. This will add the content types to the site collection.

Uninstall this way:
"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe" -o uninstallfeature -name MyCtypes

This uninstall will remove the content types from the site collection. I suspect this will fail if the content types are in use by the site.

Monday, February 2, 2009

Olympics of the Mind - Smarty Pants - 1985

(Flashback to high school... Reprinted here with attribution but without permission. From this source.)

Marcellus NY Weekly Observer 1985
Press-Observer, April 24, 1985 - Page 24
Two O.M. Teams Bring Home Trophies


Two school buses, a station wagon and a van slipped quietly back into Skaneateles late Saturday, April 20. This caravan was returning from the New York State finals of the Olympics of the Mind competition at SUNY-Buftalo.

Skaneateles pupils who participated in the Buffalo event were all winners of the regional competition March 16 in Auburn. The contests were titled "Big Top," "Ecology Dozer,"
"Compound Fracture," "Music Maestro" and "High Tech-Smarty Pants." Competition is in three divisions according to the grade level of the student.

After checking in at the guest dorms on the Buffalo campus, Friday, April 19,the 60 students and adult coaches were treated to a dinner at Niagara Falls, Canada. Mist and dense fog unfortunately totally obscured their view of the Falls.

Saturday morning the Skaneateles teams began competing against the other regional winners. The first part of the event is called "long term." This allows the competitors to show or use devices and skits to earn points toward victory. The second part of the event is called "spontaneous," where the team members use only brainpower to earn additional points.

The Division Three Skaneateles team for "High Tech-Smarty Pants" won first place for their robot and its skit dealing with an explosion in the chemistry laboratory. Coached by Georgia Peach, with Tammy Dudden assisting, the team of Sharon Graham, Eric Hadley, Maggie Kelly, David Leonard, Aaron Naas, and John Spear earned the privelege of competing in the 1985 World O.M. Finals at the University of Maryland on June 6 and 7.

A third place trophy went to the Divison Two Skaneateles team for "Ecology Dozer." This team of sixth graders, Jim Darrow, Michael Hancock, Jason Highsmith, Jilian Richards, Dietrich Rapalaski and Marcus Frick, built a vehicle powered by a small hydraulic jack. The car and driver had to move four trees from a starting point and place them into buckets along a 25 foot course. Beth and Jorge Batlle coached this team.

This team also won an award for exceptional creativity for the "long term" part of their event. Carol Anne Smith, coordinator for the elementary teams remarked that this was the first time in her memory that this award was presented for the "long term" portion of the event.

Jimmy Allred competing in Division One's "Compound Fracture" event won an award for special achievement in the "spontaneous" part of his team's event.

The Olympics of the Mind competition encourages the development of individual creative skills, team work, diligence and hard work. The predominant spirit of O.M. competitions is fun and humor, and finding new and different ways of doing things.

Frack the BEEP (in BSG podcasts)

There is a great Battlestar Galactica podcast where the Executive Producer, Ronald D. Moore, discusses each episode and the decisions and circumstances that affected aspects of the show. Very interesting and insightful.

I listen to podcasts as I drive to and from work, and unfortunately I can't listen to this one. His podcasts for each show are constructed from segments, and those segments are separated by something that sounds like an industry standard scene-change extended BEEP. Unfortunately he speaks softly enough that I have to turn up the volume to hear him, and the BEEPs are unexpected and ear-piercing. I'm convinced that he has never listened to his own podcast.

I just posted this to podcast alley for that podcast (http://www.podcastalley.com/podcast_details.php?pod_id=1819):

"Not recommended for listening while driving. Great podcast, but he speaks softly, and the transition beeps are very loud and unexpected. In the car I have to turn it up enough to hear him and I do a massive flinch each time it beeps, and I'm concerned that I'll run off the road. Ronald D. Moore, you need to listen to your own podcast, maybe while you're driving or working out. You'll want the beeps reduced in volume too."