Friday, June 13, 2008

Sitecore Item Url

One of the most common items I have to deal with is managing Sitecore items in .NET. I'm often looking for the url of the item so I can link to it on the page, I thought I would share this with the world.

Sitecore.Context.Item.Paths.GetFriendlyUrl();

Or

Item sitecoreItem = Sitecore.Context.Item;
String itemUrl = sitecoreItem.Paths.GetFriendlyUrl();

Very simple to do but not well documented.

4 comments:

Anonymous said...

classic! thanks

Unknown said...

Sitecore functionality, not well documented? No surprise there. Thanks for this.

Anonymous said...

The new version of this is:

Sitecore.Links.LinkManager.GetItemUrl(item);

what is a digital signature said...

Hi there, I am new to Infopath and I really appreciate all this great information. Thanks for it.