Sitecore adds a few orphans whenever an item is added

In my Sitecore 6.1.0 installation, I connected to the "item: added" event by executing my own custom handler as follows (in Web.config):

   <event name="item:added">
    <handler type="Sitecore.Data.Fields.ItemEventHandler, Sitecore.Kernel" method="OnItemAdded" />
    <handler type="my.project.Classes.OnSaveItemHandler, my.project" method="OnItemAdded" />
   </event>

The purpose of this is to force the use of unique names for the elements - in other words, in my OnItemAdded method, I want to search Lucene for any other elements with the same name as the element to be added.

The OnItemAdded method is called each time an element is added to the Sitecore structure. But my problem is that the method is called more than once per element . I saw that it called somewhere between 6 and 26 times for the added element, depending on where in the Sitecore structure I add the element. The body of my OnItemAdded method is empty:

    protected void OnItemAdded(object obj, EventArgs args)
    {
    }

The first time the method is called, when an element is added, the element in the parameter argsis the correct element. If the name of the element theItemName, the FullPath property will look like this:

/sitecore/content/theItemName

Each time, except for the first one, the element looks correct, but the path to the element looks like this:

[orphan]/sitecore/content/theItemName

Why is the [orphan] bit added to the full path? And why is the OnItemAdded method called more than once, although I add only one item?

+3
3

, , . , , . :

, , Sitecore , [...]

Sitecore

, , , , , , . . . , - , :

protected void OnItemAdded(object obj, EventArgs args) {
  Item item = // code to extract item from args, I forgot it

  if(item.Paths.FullPath.StartsWith("/sitecore/content")) {
    // do your stuff because you know its the first time the event fired
  }
}

, . , , Sitecore - ( , ).

+3

I had the same problem, it seems the problem is with proxies.

I would add an element and then get many of these [orphaned] paths, and each element created would have a different identifier.

Disabling proxy elements stopped the created elements [orphans].

EDIT . Found the Shadows table is damaged, truncated the Shadows table in the main database and truncated the Links database in the kernel, and then rebuilt the links database. I got 46 of these orphan entries for items that are not designed to set proxy elements on them.

0
source

All Articles