I want to access all the data of an item when I click Save button in Sitecore.

Suppose I have an ITEM A. If I click Save button in Sitecore, I would like to store all the data in the fields to a text file on the file system.

How can I achieve that? Thanks for the help.

  • item:saving event? community.sitecore.net/technical_blogs/b/sitecorejohn_blog/…
    – Marek Musielak
    Mar 20, 2019 at 15:32
  • item:saving does not make changes to an item by itself. It simply fires an event which you can capture and do what you want with the item that is saving. As I say in my answer below, however, I would recommend using the item:saved event instead. Mar 20, 2019 at 15:44
  • @DanSinclair Okay thanks. I will try this method.
    – PSS
    Mar 20, 2019 at 16:05

1 Answer 1


I would recommend creating an item:saved event handler to take the data and save the information you need.

Note: the item:saved event is different from the item:saving event and I believe preferable in this case because the item:saving event happens while the editor waits for the save command to complete.

Create a custom event handler

public class WriteFileItemSavedEventHandler
  public void OnItemSaved(object sender, EventArgs args)
    // Extract the item from the event Arguments
    Item savedItem = Event.ExtractParameter(args, 0) as Item;

    // If we don't have an item or we're not saving in the master DB, ignore this save
    if (savedItem == null || !"master".Equals(savedItem.Database?.Name, StringComparison.OrdinalIgnoreCase))

    if (!savedItem .TemplateID.Equals(new ID("{YOUR-TEMPLATE-ID}")))

    // Get the fields you care about and write out the file here

Create a config patch file

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
      <event name="item:saved">
        <handler type="Custom.Events.WriteFileItemSavedEventHandler, Custom" method="OnItemSaved"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.