SharePoint Variations – The complete Guide – Part 3 – Triggers

The variation system in SharePoint allows automatically creating and updating content in target variation labels.

Some of these actions are performed silently without a user requesting variation updates explicitly through UI interaction.

In order to perform these updates it is necessary for the variation system to be informed about content changes and changes in the variation hierarchy to keep the links between the variation peers intact.

To achieve this, the variation system registers different event handlers, which trigger content updates and the maintenance of the underlying data structures:

 

ItemAdded event on Pages Library

This event is used to restore and update relationships list entries in case that a publishing page was restored from the recycle bin.

 

ItemUpdated event on Pages Library

This event is used to trigger the peer page creation and peer page update if automatic content creation and propagation is enabled for Pages libraries which have minor versions and/or content moderation enabled.

 

ItemCheckedIn event on Pages Library

This event is used to trigger the peer page creation and peer page update if automatic content creation and propagation is enabled for Pages libraries which have minor versions and content moderation disabled.

 

ItemDeleting event on Pages Library

This event is used to collect the information about the variation group the publishing page which is about to be deleted belongs to – to make it available in the ItemDeleted event firing after the delete operation. Inside the ItemDeleted event it is not possible to get this information directly from the publishing page as this page has already been deleted at this time. 

 

ItemDeleted event on Pages Library

This event is used to update the relationships list entries for deleted and recycled publishing pages.

  • If a publishing page which resided in the source variation label is deleted or recycled then all relationships list entries referencing the variation group of the deleted/recycled page are recycled as well.
  • If a publishing page which resided in a target variation label was deleted or recycled then its relationships list entry is marked as deleted by setting the value of the “Deleted” column of the relationships list entry to “Yes”.

In case of a restore of a deleted page from the recycle bin, these actions have to be reverted. See the ItemAdded event for details.

 

FeatureActivated event on PublishingWeb

This event is used to trigger source site variation to target labels when the Publishing feature is activated on a site. This happens as well when a new Publishing site is provisioned inside the source label or if the feature is manually activated on a site that resides in the source label.

 

FeatureDeactivating event on PublishingWeb

This event is used to delete the relationship list entries and the variation specific properties when deactivating the publishing feature on a site.

 

WebDeleting event on PublishingWeb

This event is used to cancel a delete operation in case that the site being deleted is the Root Site of the Variation Hierarchy (if spawned labels exist) or a Top site of a Variation Label. In all other cases, the variation system uses this event to clean up the relationship list items for the deleted site and its pages.

 

WebMoving event on PublishingWeb

This event is used to cancel the move operation in case that the site being moved is the Top site of a Variation Label, as moving a Variation Top site would destroy the variation label it belongs to.

 

WebMoved event on PublishingWeb

This event is used to trigger source site variation to target labels if a site is moved from outside the source label into the source label. In addition, it will cleanup the information in the relationship list in case that a site is moved out of a variation label.

4 Comments


  1. So where do you tie into that event? I need to create a new list whenever a new variation label is created and then copy list contents from a list on the root to that list. This wouldn't be an issue except that the list in the root was created in code instead of using the SharePoint UI to create it, so it cannot be moved/copied into the base variation to be duplicated.

    Reply

  2. What you could do is to register an item updated event for the variation labels list.

    Here you could check when a "Hierarchy Is Created" field is changed to perform the copy.

    Reply

  3. Thank you! I still have one more problem. When I put ListUrl="/Variation Labels", it doesn't pick it up. It just fires ItemUpdated for ALL lists. The only url I can find for variation labels after going through debugging and attaching to process says that the url for variation labels is "/Variation Labels". Any ideas?

    Reply

  4. Hm… haven't tried but it is a normal SharePoint List. So if this works for other lists I would expect it to work for this list as well.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.