your link to better business solutions

Sitecore – Display number of items in a folder

Problem: When working with folders, I often find it frustrating that I can’t see the number of items in that folder.  If there are a few, you can count, but if there are many it becomes a problem.  If there is a parent folder, it is as simple as looking into the parent folder to see the number of sub-items in the folder you are interested in.  That might not always be the case.


To resolve this, I thought it would be nice to show the count when you are viewing a folder.  Here is what I did with the help of Mr. Matt Hovany:

1. Open Folder.xaml.xml file in \Website\sitecore\shell\Applications\Content Manager\Editors\Folder folder.

2. Add a Literal right above the GridPanel as shown below:

    <Sitecore.Controls.HtmlPage runat="server">
      <Stylesheet runat="server" Src="Folder.css" DeviceDependant="true" x:placeholder="Stylesheets"/>
      <AjaxScriptManager runat="server"/>
      <ContinuationManager runat="server" />
      <div> <!-- Line Added -->
        <asp:Literal ID="TotalLit" runat="server" Visible="false"  /> <!-- Line Added -->
      </div> <!-- Line Added -->
      <GridPanel runat="server" Width="100%" Height="100%">
        <Scrollbox runat="server" ID="ItemList" Width="100%" Height="100%" Border="none" Padding="0px" Background="transparent" GridPanel.Height="100%" ContextMenu="FileList_ContextMenu" />

3. Create a new class similar to the one below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Sitecore.Shell.Applications.ContentEditor.Editors.Folder;
using Sitecore.Web.UI.XamlSharp.Xaml;
using Sitecore.Web;
using Sitecore.Data;
using Sitecore.Globalization;
using Sitecore.Data.Items;

namespace SitecoreCustomFolder
    public class CustomFolder : Sitecore.Shell.Applications.ContentEditor.Editors.Folder.FolderPage

        protected System.Web.UI.WebControls.Literal TotalLit;

        protected override void OnLoad(EventArgs e)

            if (!XamlControl.AjaxScriptManager.IsEvent)
                string queryString = WebUtil.GetQueryString("id");
                string name = WebUtil.GetQueryString("language");
                string databaseName = WebUtil.GetQueryString("database");
                ItemUri uri = new ItemUri(queryString, Language.Parse(name), Sitecore.Data.Version.Latest, databaseName);
                Item item = Database.GetItem(uri);

                if (item != null)
                    List<Item> items = this.GetItems(item);
                    if (items.Count != 0)
                        this.TotalLit.Text = "<div class=\"scTitle scTilesTitle\">Items in Folder: " + items.Count.ToString() + " </div>";
                        this.TotalLit.Visible = true;

4. Modify the Folder.xaml.xml to reflect the new class on the inherits attribute:

<Sitecore.Shell.Applications.ContentEditor.Editors.Folder x:inherits="SitecoreCustomFolder.CustomFolder">

5. Here is the end result:

Sitecore: Publish Item with Sub-Items quicker!

Here is a quicker way to publish item with subitems.  Usually when I try to access the publish menu dropdown it takes a while depending on what is happening on the dev boxes.  I know this is not much of an improvement but its definitely quicker.  Typically it takes 3 clicks to reach the menu item as shown below.


Here is how you can improve that.

Step 1: Change db to core

Step 2: Navigate to /sitecore/content/Applications/Content Editor/Ribbons/Chunks/Publish

Step 3: Right click and insert from template on the Publish item

Step 4: Select /sitecore/templates/System/Ribbon/Large Button template and name it Publish Item (you can name it as you please)

Step 5: Enter the following values in the corresponding fields as shown in the screenshot for the newly created item.

Header: Publish Item

Icon: Network/16×16/earth_add.png ( you can pick what you like)

Click: item:publish(id=$Target)

Tooltip: Publish the item with subitems

Step 6: Switch back to Master db.

Step 7: Access the newly created item under the publish ribbon.

Step 8: This brings up the same dialog as the publish item menu in the publish dropdown.


Link to an older post:


Sitecore Lucene Search Index

Sitecore has been using Lucene search since version 5, which used the Sitecore.Data.Indexing namespace and Sitecore -> Indexes section in the Web.Config.

Starting in Sitecore 6.4, they introduced a new Search namespace – Sitecore.Search, this uses the Sitecore -> Search -> Configuration -> Indexes section in Web.Config.

From what I know, Sitecore recommends using the new namespace and the old namespace is going to be deprecated starting Sitecore 6.5. The following is a blurb from Sitecore 6.5 Release notes from SDN:
“The Sitecore.Data.Indexing namespace has been deprecated and will be removed in a future version of the CMS in favor of the more powerful and flexible Sitecore.Search classes and corresponding index definitions. ”

Since there is only one document on this new namespace, it’s difficult to get more information when you find yourself in a bind. I had to google search to find bits and pieces and so I am writing this post.

Here is the link to the PDF on this site. Click Here (NO SDN access needed)

The basic configuration is given below:

      <configuration type="Sitecore.Search.SearchConfiguration, Sitecore.Kernel" singleInstance="true">
        <indexes hint="list:AddIndex">
          ... ... ...
          <index id="IndexNAME" type="Sitecore.Search.Index, Sitecore.Kernel">
            <param desc="name">$(id)</param>
            <param desc="folder">im_index</param>
            <Analyzer ref="search/analyzer"/>
            <locations hint="list:AddCrawler">
              <master type="Sitecore.Search.Crawlers.DatabaseCrawler, Sitecore.Kernel">
                <Tags>master content</Tags>
                <include hint="list:IncludeTemplate">
                  <template comment="Template1">{8917CADF-2148-4328-B595-217C5A9CCA7D}</template>
                  <template comment="Template2">{2A18027D-CA51-4E5D-A7C1-51096E09C16C}</template>
                <include hint="list:ExcludeTemplate">
                <!--<include hint="list:IncludeField">

Here is a piece of sample code to query the index:

    Sitecore.Search.Index searchIndex = Sitecore.Search.SearchManager.GetIndex("Search Index Name"); //replace string with the name of the search index
    using (IndexSearchContext context = searchIndex.CreateSearchContext())
        SearchHits hits = context.Search("search string");  //replace string with the actual search string
        SomeRepeater.DataSource = hits.FetchResults(0, 25); //first param is the start item, second is the count
        ResultsCount = hits.FetchResults(0, hits.Length).Count();

Here are some useful links:

Search Index Troubleshooting by Alex Shyba

Index Viewer in Sitecore Shared Source


I hope this is useful. If you have any questions please don’t hesitate to get in touch!

What Does a Verizon iPhone Mean to You?

The long rumored partnership between Verizon and Apple is reportedly just around the corner. It is supposed to become reality for the consumer in early 2011.

Whatever you think about Apple and its methods, the iPhone is undeniably huge. Still, Apple had to step out from its exclusive AT&T contract because of top flight competition from Android phones.

With the world’s largest networks and distribution system in Verizon, Apple opens itself up to a market that previously wouldn’t look at an iPhone. Completely realistically, iPhone sales could double under a Verizon contract.

This also opens up the possibility of a iPhone that takes advantage of Verizon’s 4G LTE service, coming to 38 cities and 60 airports by the end of the year. With significantly faster download rates, better penetration through buildings and walls, and an extensive initial rollout, the LTE service could have a significant impact on mobile services. I expect a whole new brand of user to embrace smartphone and mobile technology.

What does this mean to the business market? It means that if you haven’t jumped onto the mobile bandwidth, so to speak, you’ll want to look now at making your website and online presence mobile-device friendly.

It won’t take long for other carriers to have their own version of Verizon’s LTE service online. Once the standard has been raised, they can’t afford to fall behind. Meanwhile, although some of the new Verizon iPhone users will transfer from other smartphones, including Android phones, many will be first time smartphone users. We’re going to see another significant upsurge in mobile device users next year, and we’ll keep piling them on after that.

I see a day when mobile is the norm, and we’re getting there quickly. Make sure your business is on board.

Google Scores “Instant” Home Run

While Bing by Microsoft seemed to some like a huge step forward in the search world, Google’s Instant is a whole new world of search.

Rendering the “enter” key nearly useless, Instant anticipates your query and combines its Google Suggests recommendations that would appear as you typed in past queries with an instant live search for those queries as you type.

Google advertises a 2 – 5 second time savings per search, and “smarter” predictions that allow you to find what you’re actually looking for faster. The results are, according to Google, automatically localized, giving you relevant results each time, without having to type in limiting words or phrases.

Once again, Google has defined the paradigm for search.

Will this be enough to counter the bad publicity over privacy intrusions by a Google Site Reliability Engineer David Barksdale? This latest security breech and the perception of a “hush hush” handling of the problem (Barksdale was “quietly” fired) adds to the perception that Google may be careless with security.

It’s a concern, but not a major one. Google is keeping careful tabs on its business and its business model. They are on top of what is going on in the search engine business in particular and the cloud computing business in general.

Because of Google’s continual innovation and leaps ahead of the technology curve, I predict that Google, Google Instant, Android, Apps, Gmail and all the other innovative Google features will become even more popular in coming months and years.

Sitecore – Upload to Media Library Issue/Problem

Recently I had an issue while importing few thousand images and documents into the Sitecore Media Library. I had the following settings in Web.Config:

Determines if media should be uploaded as files or as database blobs.
Default: false

<setting name="Media.UploadAsFiles" value="false" />

This setting controls if item paths are used for constructing media URLs.
If false, short ids will be used.
Default value: true

<setting name="Media.UseItemPaths" value="true" />

Each time, it would import only a few files and it would stop. I tried killing all processes, lower the CPU and Memory usage but that didn’t make any difference.

According to the friendly and helpful Sitecore Customer Service Rep, Upload folder is managed by Sitecore.Resources.Media.UploadWatcher. Each time a file is added to the upload folder, UploadWatcher creates similar structure in media library. It is not a separate task or webservice, just simple uploading job started by “Created” event on filesystem.

The reason for this issue is that Sitecore uses System.IO.FileSystemWatcher object for file uploading (Sitecore use it to watch changes); when a lot of files are added at once, the FileSystemWatcher’s internalBuffer fills up and starts skipping files.

Checkout this article

As a result of my Ticket, they created a workaround which is available at You would need a Sitecore developer account to login.

As a workaround you need to use Sitecore.Support.322918.dll file. The workaround increases the InternalBuffer to avoid the unexpected skipping of files.

1. Add the string <add type=”Sitecore.Support.UploadWatcher,Sitecore.Support.322918″ name=”SitecoreUploadWatcher”/> before each occurrence of the string <add type=”Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel” name=”SitecoreUploadWatcher”/>

(see <system.webServer>/<modules> section and <system.web>/<httpModules> section)

2. Comment out all such lines: <add type=”Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel” name=”SitecoreUploadWatcher”/>

3. Put the Sitecore.Support.322918.dll file into the /bin folder of your web site

4. In the web.config file, add the following string under the <settings> section

<setting name=”FileSystemWatcherBufferSize” value=”4096000″/>

Such value seems to be enough for 5000 files, but you can increase it further to be sure that even files with very long names are uploaded.

For example:

If the full file path contains 100 symbols, it takes 200 bytes, 32000 files will take 6400000 bytes (6250 kb), so the setting value should be:

<setting name=”FileSystemWatcherBufferSize” value=”6400000 “/>

As always, please backup before making any significant changes.

P.S.: UploadWatcher calls MediaManager.Creator.FileCreated(filePath); – you can try to fire the same method with path to the missing folder as parameter. There is another methos for FolderCreated as well.

Hope this helps. Credit goes to Sitecore and its Customer Service Reps.