Programmatically/automatically RE-index document library sharepoint 2013


SharePoint 2013 provides the ability to reindex a document library or a list.

You can add an event receiver on itemAdded or itemAdding based on the business logic and implement the code which adds the search version for the document library or list to be re-indexed.

Enjoy, Atul

Event Receiver
/// <summary>
        /// An item is being added.
        /// </summary>
        public override void ItemAdding(SPItemEventProperties properties)


            SPList list = properties.List;

            this.EventFiringEnabled = false;

            object version = list.RootFolder.Properties["vti_searchversion"];

            int iVersion = Convert.ToInt32(version);

            list.RootFolder.Properties["vti_searchversion"] = iVersion + 1;


            this.EventFiringEnabled = true;


No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: