Return to doc.sitecore.com

Valid for Sitecore 5.3.1
8.  InternalLink
Prev Next

The simple field type, Security stores it raw value as text:

  /sitecore/content/Home/Sample Forms

It's possible to resolve this data type by using implicit casting

public static string outInternalLink(Sitecore.Data.Items.Item item, string sFieldName)
{
  System.Text.StringBuilder builder
= new System.Text.StringBuilder();
  Sitecore.Data.Fields.InternalLinkField internalLinkField
= item.Fields[sFieldName];
  builder.Append(
"TargetItem.Name = " + internalLinkField.TargetItem.Name);
  builder.Append(
"<br />");      
  builder.Append(
"internalLinkField.Path = " + internalLinkField.Path);      
  
return builder.ToString();      
}

Result:

TargetItem.Name = Sample Forms

internalLinkField.Path = /sitecore/content/Home/Sample Forms

 


Prev Next