In the 1st part of this series I made overview of basic features and configuration settings of the variations in Sharepoint. In this part I will describe basic use cases and show how configuration settings affect them. As you remember from 1st part there is possibility to specify how content (pages and sites) will be propagated: manually or automatically (Site settings > Variations > Automatic Creation). However there are another settings which affects this behavior: using PowerShell you can disable automatic propagation of the pages (not sites), so setting “Automatic Creation” will be ignored for the pages, although sites will continue to follow it (see Manage automatic propagation of variation pages for details). So we have 2 options: manage variations propagation via UI (Site settings > Variations > Automatic Creation) and using PowerShell. What is the difference between e.g. manual propagation specified in UI and PowerShell? In this post I’m going to answer these and other questions.
As you also remember from 1st part there are several timer jobs related with variations. For convenience I will show them as well:
Job title | Description |
Variations Create Hierarchies Job Definition | Creates a complete variations hierarchy by spawning all sites and pages from the source site hierarchy for all Variation labels. |
Variations Create Page Job Definition | Creates peer pages in variant sites. |
Variations Create Site Job Definition | Creates variant sites when the Variations Automatic Creation setting is disabled. |
Variations Propagate Page Job Definition | Updates peer pages in variant sites. |
Variations Propagate Site Job Definition | Creates variant sites when the Variations Automatic Creation setting is enabled. |
I will show when each of these jobs are used depending on what settings are configured for automatic propagation and how you propagate variations. As there are many parameters which affect variation usage I think that it will be more clear to show them in tables.
Lets start from creation of variations hierarchy. Go to Site settings > Variations labels and create new label. Check “Source Variation” option for new label. The create at least one variation target. All sites in variations hierarchy will use the same site template as site template of variation source (site template dropdown list is available only for source when “Source Variation” checkbox is checked. For variation targets it will be disabled). After you created all labels click “Create hierarchies” button. Variations hierarchy will be created by time job “Variations Create Hierarchies Job Definition” – you can force via Central Administration > Monitoring > Job Definitions > Variations Create Hierarchies Job Definition (for your web application) > Run now. After that variation hierarchy will be created and you can test pages and sites variations propagation with it.
At first lets check how sites propagation works, because it is more simple in sense that they don’t depend from PowerShell settings.
Sites:
Automatic Creation = On | Automatic Creation = Off |
In order create new site and propagate it on variation targets you need to perform the following steps: 1. Create publishing site under variation source (e.g. from OTB Site manager page) 2. As Automatic Creation = On, newly created site will be propagated automatically using timer job “Variations Propagate Site Job Definition”. You can force it if will go to Central Administration > Monitoring > Job Definitions > Variations Propagate Site Job Definition (for you web application) > Run now 3. As result new sub site will be propagated to all variation labels. I.e. all variation labels will now have the same sub site as variation source | When Automatic Creation = Off you need to do the following: 1. Create publishing site under variation source (e.g. from OTB Site manager page) 2. In Site manager select newly created site and from menu choose New > Variation site 3. New window will be opened when you can specify under what variation label you need to propagate this site. This is the difference between automatic propagation and manual propagation: in case of automatic propagation site is propagated to all variation labels, in case of manual propagation – only to one variation label. Of course you can propagate it manually to all labels one by one. 4. When variation is created you can force its creation from Central Administration > Monitoring > Job Definitions > Variations Create Site Job Definition (for you web application). I.e. other job is used in order to propagate sites when manual creation is selected. |
Now lets check similar cases for pages. They are more complicated because both UI configuration settings and PowerShell settings affects their propagation. Also for pages we need to separately check how new pages are propagated and how updates of existing pages are copied to variation labels.
First of all disable automatic variation propagation by the following PowerShell script (see Manage automatic propagation of variation pages):
1: $site = Get-SPSite "<SiteURL>"
2: $folder = $site.RootWeb.Lists["Relationships List"].RootFolder
3: $folder.Properties.Add("DisableAutomaticPropagation", $true)
4: $folder.Update()
5: $site.Close()
So now we are considering the case when Automatic propagation (PowerShell) = Off:
Automatic Creation (UI) = On | Automatic Creation (UI) = Off | |
New page propagation | 1. Create new publishing page under variations source (Site Actions > Create Page) and publish it
2. In order to propagate this page to variation targets in ribbon Publish in Variations category you can choose one of the 2 options: 2.1. Create – it will propagate page to only one selected variation target. You can specify different URL for the variation page. Copied page will have Draft status initially. In order to force page propagation you need to use “Variations Create Page Job Definition”. If page already exists on all target sites it will add the following message in variations log: ”All variation sites of the current site already have a variation of this page. Cannot create a new page variation” 2.2. Update – it will copy the page to all variation labels. All copied pages will have the same URL as source page and will have Draft status initially. In order to force pages propagation you need to use “Variations Propagate Page Job Definition” |
When you disable automatic variations propagation via PowerShell then Automatic Creation UI setting is ignored for pages. It only affects sites. So all behavior will remain the same as for Automatic Creation (UI) = On. |
Updates of existing page propagation | 1. Update content on variation source page (e.g. some rich html field) and publish the page
2. Choose in ribbon Publish > Variations > Update. It will propagate changes on all variation pages on target sites 3. In order to force pages propagation you need to use “Variations Propagate Page Job Definition” |
The same as for new pages - Automatic Creation UI setting is ignored and all behavior will remain the same as for Automatic Creation (UI) = On. |
Now lets enable automatic pages propagation in PowerShell and will make the same test:
1: $site = Get-SPSite "<SiteURL>"
2: $folder = $site.RootWeb.Lists["Relationships List"].RootFolder
3: $folder.Properties.Remove("DisableAutomaticPropagation")
4: $folder.Update()
5: $site.Close()
Now Automatic propagation (PowerShell) = On:
Automatic Creation (UI) = On | Automatic Creation (UI) = Off | |
New page propagation | 1. Create new publishing page under variations source (Site Actions > Create Page) and publish it
2. In order to propagate this page to variation targets in choose Publish > Variations > Update – it will copy the page to all variation labels. All copied pages will have the same URL as source page and will have Draft status initially. In order to force pages propagation you need to use “Variations Propagate Page Job Definition” |
1. Create new publishing page under variations source (Site Actions > Create Page) and publish it
2. Now if you will try to propagate new page by forcing “Variations Propagate Page Job Definition” – it won\t propagate it. Instead it will show the following message in Variations log (Site settings > Variation logs): ”Variation Site and Page Auto-Spawn is off so no new pages will be created” 3. In order to propagate this page to variation targets in ribbon Publish in Variations category you can choose one of the 2 options: 3.1. Create – it will propagate page to only one selected variation target. You can specify different URL for the variation page. Copied page will have Draft status initially. In order to force page propagation you need to use “Variations Create Page Job Definition” 3.2. Update – it will copy the page to all variation labels. All copied pages will have the same URL as source page and will have Draft status initially. In order to force pages propagation you need to use “Variations Propagate Page Job Definition” |
Updates of existing page propagation | 1. Update content on variation source page (e.g. some rich html field) and publish the page
2. In order to propagate changes you don’t need to click any buttons in ribbon Publish > Variations. It will be automatically propagated by “Variations Propagate Page Job Definition” |
For updates behavior is the same as for Automatic Creation (UI) = On. |
That’s all what I wanted to write about variation use cases. Hope it will help you to understand the big picture and you will be able to use it in your every day work.
Hi alex,
ReplyDeleteWhen i execute the script i am getting error
saying you cannot call a method on a null valued expression at DisableAtomaticPropagation line 3. Please let me know what i am doing wrong.
Ranjani,
ReplyDeletethis script works on root site collection only. Also site should be created using Publishing site template because variations are part of Publishing infrastructure
hi Alex,
ReplyDeleteThanks for your quick reply.
It is the root site collection only and is created using publishing infrastructure. I checked the Site collection feature , the publishing infrastructure is active. Am i missing anything else??
The line
$folder= $site.RootWeb.Lists["Relationships List"].RootFolder
is returning null.
did your root site is created using English language?
ReplyDeleteHi Alex,
ReplyDeleteSorry for late reply.The above problem is resolved after giving proper permission to the user