Tuesday, May 23, 2006

Item Name Length oddities

Was running some custom code that created lots and lots of items in the Master Database. Now nevermind the reasoning for now, but the code needs to create items in a "flat" structure (as opposed to a folder-based hierarchical one) and some of those names can turn out to be fairly long. Wasn't long before I encountered this one:

An item name can not be more than 100 characters in length at Sitecore.Data.Items.ItemUtil.AssertItemName(String name) at Sitecore.Data.DataManager.AssertItemName(String itemName) at Sitecore.Data.DataManager.AddFromMaster(String itemName, ID itemID, ID masterID, Item parent) at Sitecore.Data.Items.Item.Add(String name, MasterID masterID)

Now, ok... I can understand the fact that there HAS to be some sort of limit imposed on Item Name length. What eludes me though, is the "100 character" limit, when the database looks like this: I looked around, and this length isn't configurable anywhere I can locate (in Sitecore 5.1.x atleast).

2 Comments:

Anonymous Krystle said...

Hey Mark, I know you posted this entry years ago! But I am new to Sitecore, I just started developing with Sitecore in Feb this year and I encountered a similar problem with item names that are too long.

You possibly know this by now, but just incase there is a setting in the Web.Config file where you can set the maximum item length (MaxItemLength .. trying to remember off the top of my head). I believe the default is 100 characters, which is fine, but then of course you have the problem with character lengths with IIS I think the maximum is 200 and something characters?? So it is a tad frustrating if you want lots of folders within folders thus requires lengthy filename characters..

13 August, 2008 10:28  
Blogger Mark Cassidy said...

Oh my, blast from the past ;-)

I guess deep hierarchies should be avoided to some extent. You might want to look closer at Sitecore's Alias functionality however - if you catch it on a good day when it works as intended, you can carve off a fair chunk of a deep path with it :-)

13 August, 2008 11:21  

Post a Comment

Links to this post:

Create a Link

 

<< Home