in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

This Blog

Syndication

Mirrored Blogs

Enable variations programmatically

Last week I was trying to enable variations using a feature in SharePoint, but I soon realized that I had a problem because Microsoft decided to make all the variation-class internal. So that shouldn't be a problem, why not use reflection. That didn't work either, so back to the good old Lutz Roeder's Reflector to see what's going on. I soon found out that variations are dependent on 2 hidden lists (VariationSettings, VariationLabels), both lists can be found using the AllProperties of the root web:

 Get variationlists

The variationlabels list contains a listitem for each variation that is available on the site, just add a new listitem to the list (make sure there is only one listitem that has the field "Is Source" set to true):

 Create variationlabel

The variationsettings are a little bit different, the settings are saved to the propertybag of the rootfolder of the list:

 Set variationsettings

These settings where easy, but then came the hard part, how do I create the hierarchies since all logic is internally scoped. Then I had a brainwave, why not try the good old webclient... It works:

 call create hierachies

Now I was finally able to create the hierachies in my build-script.

Read the complete post at http://www.lankamp.net/post/2007/10/Enable-variations-programmatically.aspx


Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts