Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5969409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:13:34+00:00 2026-05-22T20:13:34+00:00

In my Sitecore 6.1.0 installation I have hooked onto the item:added event by implementing

  • 0

In my Sitecore 6.1.0 installation I have hooked onto the “item:added” event by implementing 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 enforce unique names for items – in other words, in my OnItemAdded method I want to do a Lucene search for any other items with the same name as the item being added.

The OnItemAdded method is called every time an item is added in the Sitecore structure. But my problem is – the method is called more than once per item. I’ve seen it called anywhere between 6 and 26 times per added item, depending on where in the Sitecore structure I add the item. The body of my OnItemAdded method is empty:

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

The first time the method gets called when an item is added, the item in the args parameter is the correct item. If the item’s name is theItemName, the FullPath property will look like this:

/sitecore/content/theItemName

Every time except for that first one, the item looks correct, but the item’s path looks like this:

[orphan]/sitecore/content/theItemName

Why is the [orphan] bit being added onto the full path? And why is the OnItemAdded method being called more than once, even though I am only adding one item?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:13:35+00:00Added an answer on May 22, 2026 at 8:13 pm

    I believe there are known issues with event likes this where the method will be called several times. I know I had a similar experience where I was trying to programatically create a role for an item when the item was created. John West said the following as a precaution:

    I seem to remember that Sitecore sometimes fires some events more than once, so you might want to check for that […]

    John then provided a link to a blog post called Intercepting Item Updates with Sitecore

    In my code, I had a check that checked to see if the operation I was looking for had already occurred, e.g. does the role for the item exist. In your case, this might be a bit harder to check in the method. Maybe you can do something sneaky like:

    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
      }
    }
    

    Again, this is very hackish. I’d say this is a last resort if Sitecore support cannot provide any better options (or there aren’t any better options posted on Stack overflow).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing a custom field in Sitecore for the Content Editor, and I need
I have a Sitecore content structure where any single item can have a number
The sitecore keepalive task set in web.config which calls a 'keepalive' url is configured
In Sitecore I have created a custom field (via this recipe: http://sdn.sitecore.net/Articles/API/Creating%20a%20Composite%20Custom%20Field/Adding%20a%20Custom%20Field%20to%20Sitecore%20Client.aspx ) The
I have a Sitecore/ASP.NET projects that I'm developing. Today at some point I inadvertently
I have to use Sitecore 6.5 with MVC framework and as per the reference
I have a page in Sitecore that displays the list of clients. There's a
We have limit on number of concurrent sitecore users. We are facing a unique
I'm writing a custom field for Sitecore and I want a list box. Interestingly,
Hi guys i am new to Sitecore and asp.net and iis. I have installed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.