TargetItem Properties

TargetItem Properties

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Context
  • Sitecore.Data.Database
  • Sitecore.Data.Fields.ReferenceField
  • Sitecore.Data.Items.Item
  • Sitecore.MainUtil

TargetItem Properties C# Web Control Code

//get Link Fields metadata item from context database using item guid
Sitecore.Data.Database db = Sitecore.Context.Database;
Sitecore.Data.Items.Item item = db.GetItem("{E3B7CC3C-8C55-4401-A3C9-0FEA9CDA3E9C}");
if (item == null) return;

Sitecore.Data.Fields.ReferenceField drplnkFld = item.Fields["example droplink"];
if (drplnkFld == null) return;

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("C# Web Control Real-time Output");
output.RenderEndTag();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//using : for colon and   for space
output.Write("{0}: {1}", "Field", drplnkFld.InnerField.DisplayName);
output.RenderEndTag(); //P

output.Write("Context Menu: " + "<b>" + drplnkFld.TargetItem.Appearance.ContextMenu + "</b><br/>"); 
output.Write("Display Name: " + "<b>" + drplnkFld.TargetItem.Appearance.DisplayName + "</b><br/>"); 
output.Write("Is Hidden? " + "<b>" + drplnkFld.TargetItem.Appearance.Hidden.ToString() + "</b><br/>"); 
output.Write("Icon: " + "<b>" + drplnkFld.TargetItem.Appearance.Icon + "</b><br/>"); 
output.Write("Long Description: " + "<b>" + drplnkFld.TargetItem.Appearance.LongDescription + "</b><br/>"); 
output.Write("Is Read Only? " + "<b>" + drplnkFld.TargetItem.Appearance.ReadOnly.ToString() + "</b><br/>"); 
output.Write("Ribbon: " + "<b>" + drplnkFld.TargetItem.Appearance.Ribbon + "</b><br/>"); 
output.Write("Short Description: " + "<b>" + drplnkFld.TargetItem.Appearance.ShortDescription + "</b><br/>"); 
output.Write("Skin: " + "<b>" + drplnkFld.TargetItem.Appearance.Skin + "</b><br/>"); 
output.Write("Style: " + "<b>" + drplnkFld.TargetItem.Appearance.Style + "</b><br/>"); 
output.Write("Axes Level: " + "<b>" + drplnkFld.TargetItem.Axes.Level.ToString() + "</b><br/>"); 
output.Write("Axes Root: " + "<b>" + drplnkFld.TargetItem.Axes.Root.Name + "</b><br/>"); 
if (drplnkFld.TargetItem.Branch != null) 
output.Write("Branch Name: " + "<b>" + drplnkFld.TargetItem.Branch.Name + "</b><br/>"); 
output.Write("Branch ID " + "<b>" + drplnkFld.TargetItem.BranchId.ToString() + "</b><br/>"); 
output.Write("Is Editing Mode? " + "<b>" + drplnkFld.TargetItem.Editing.IsEditing.ToString() + "</b><br/>"); 
output.Write("Is Empty? " + "<b>" + drplnkFld.TargetItem.Empty.ToString() + "</b><br/>"); 
output.Write("Has Children? " + "<b>" + drplnkFld.TargetItem.HasChildren.ToString() + "</b><br/>"); 
output.Write("ID: " + "<b>" + drplnkFld.TargetItem.ID.ToString() + "</b><br/>"); 
output.Write("Key: " + "<b>" + drplnkFld.TargetItem.Key + "</b><br/>"); 
output.Write("Language Name: " + "<b>" + drplnkFld.TargetItem.Language.Name + "</b><br/>"); 
output.Write("Links Item Name: " + "<b>" + drplnkFld.TargetItem.Links.Item.Name + "</b><br/>"); 
output.Write("Can Lock? " + "<b>" + drplnkFld.TargetItem.Locking.CanLock().ToString() + "</b><br/>"); 
output.Write("Can Unlock? " + "<b>" + drplnkFld.TargetItem.Locking.CanUnlock().ToString() + "</b><br/>"); 
output.Write("Has Lock? " + "<b>" + drplnkFld.TargetItem.Locking.HasLock().ToString() + "</b><br/>"); 
output.Write("Is Locked? " + "<b>" + drplnkFld.TargetItem.Locking.IsLocked().ToString() + "</b><br/>"); 
output.Write("Is Modified? " + "<b>" + drplnkFld.TargetItem.Modified.ToString() + "</b><br/>"); 
output.Write("Name: " + "<b>" + drplnkFld.TargetItem.Name + "</b><br/>"); 
output.Write("Originator ID: " + "<b>" + drplnkFld.TargetItem.OriginatorId.ToString() + "</b><br/>"); 
output.Write("Parent Name: " + "<b>" + drplnkFld.TargetItem.Parent.Name + "</b><br/>"); 
output.Write("Parent ID: " + "<b>" + drplnkFld.TargetItem.ParentID.ToString() + "</b><br/>"); 
output.Write("Conent Path: " + "<b>" + drplnkFld.TargetItem.Paths.ContentPath + "</b><br/>"); 
output.Write("Full Path: " + "<b>" + drplnkFld.TargetItem.Paths.FullPath + "</b><br/>"); 
output.Write("Is Content Item? " + "<b>" + drplnkFld.TargetItem.Paths.IsContentItem.ToString() + "</b><br/>"); 
output.Write("Is Fully Qualified? " + "<b>" + drplnkFld.TargetItem.Paths.IsFullyQualified.ToString() + "</b><br/>"); 
output.Write("Is Media Item? " + "<b>" + drplnkFld.TargetItem.Paths.IsMediaItem.ToString() + "</b><br/>"); 
output.Write("Long ID: " + "<b>" + drplnkFld.TargetItem.Paths.LongID + "</b><br/>"); 
output.Write("Media Path: " + "<b>" + drplnkFld.TargetItem.Paths.MediaPath + "</b><br/>"); 
output.Write("Parent Path: " + "<b>" + drplnkFld.TargetItem.Paths.ParentPath + "</b><br/>"); 
output.Write("Path: " + "<b>" + drplnkFld.TargetItem.Paths.Path + "</b><br/>"); 
output.Write("Hide Version? " + "<b>" + drplnkFld.TargetItem.Publishing.HideVersion.ToString() + "</b><br/>"); 
output.Write("Never Publish? " + "<b>" + drplnkFld.TargetItem.Publishing.NeverPublish.ToString() + "</b><br/>"); 
output.Write("Publish Date: " + "<b>" + drplnkFld.TargetItem.Publishing.PublishDate.ToShortDateString() + "</b><br/>"); 
output.Write("Unpublish Date: " + "<b>" + drplnkFld.TargetItem.Publishing.UnpublishDate.ToShortDateString() + "</b><br/>"); 
output.Write("Valid From: " + "<b>" + drplnkFld.TargetItem.Publishing.ValidFrom.ToShortDateString() + "</b><br/>"); 
output.Write("Valid To: " + "<b>" + drplnkFld.TargetItem.Publishing.ValidTo.ToShortDateString() + "</b><br/>"); 
output.Write("Browse Only: " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.BrowseOnly.ToString() + "</b><br/>"); 
output.Write("Is Modified? " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.ForceModified.ToString() + "</b><br/>"); 
output.Write("Invalid? " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.Invalid.ToString() + "</b><br/>"); 
output.Write("Is External? " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.IsExternal.ToString() + "</b><br/>"); 
output.Write("Is Virtual? " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.IsVirtual.ToString() + "</b><br/>"); 
output.Write("Owner DB Name: " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.OwnerDatabase.Name + "</b><br/>"); 
output.Write("Read Only Stats: " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.ReadOnlyStatistics.ToString() + "</b><br/>"); 
output.Write("Sort Order: " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.SortOrder + "</b><br/>"); 
output.Write("Temporary: " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.Temporary.ToString() + "</b><br/>"); 
output.Write("Runtime Valid From: " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.ValidFrom.ToShortDateString() + "</b><br/>"); 
output.Write("Runtime Valid To: " + "<b>" + drplnkFld.TargetItem.RuntimeSettings.ValidTo.ToShortDateString() + "</b><br/>"); 
output.Write("Template Name: " + "<b>" + drplnkFld.TargetItem.TemplateName + "</b><br/>"); 
output.Write("URI: " + "<b>" + drplnkFld.TargetItem.Uri.ToString() + "</b><br/>"); 
output.Write("Version Number: " + "<b>" + drplnkFld.TargetItem.Version.Number.ToString() + "</b><br/>"); 
output.Write("Layout Name: " + "<b>" + drplnkFld.TargetItem.Visualization.Layout.Name + "</b>");output.RenderEndTag(); //Div


TargetItem Properties C# Web Control Output

Field: Example Droplink

Context Menu: 
Display Name: Context Device
Is Hidden? False
Icon: Business/32x32/table_selection_row.png
Long Description: 
Is Read Only? False
Ribbon: 
Short Description: 
Skin: 
Style: 
Axes Level: 5
Axes Root: sitecore
Branch ID {00000000-0000-0000-0000-000000000000}
Is Editing Mode? False
Is Empty? False
Has Children? True
ID: {F01CA6B2-E36D-4AF0-84F2-E533F0C6E3B1}
Key: contextdevice
Language Name: en
Links Item Name: ContextDevice
Can Lock? True
Can Unlock? True
Has Lock? False
Is Locked? False
Is Modified? False
Name: ContextDevice
Originator ID: {00000000-0000-0000-0000-000000000000}
Parent Name: Devices
Parent ID: {FF343316-75E0-49F1-BA22-64175B3471A3}
Conent Path: /Home/Developers/Devices/ContextDevice
Full Path: /sitecore/content/Home/Developers/Devices/ContextDevice
Is Content Item? True
Is Fully Qualified? True
Is Media Item? False
Long ID: /{11111111-1111-1111-1111-111111111111}/{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}/{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}/{8AB7474D-375C-41BD-8FAA-302B8BDFE1F6}/{FF343316-75E0-49F1-BA22-64175B3471A3}/{F01CA6B2-E36D-4AF0-84F2-E533F0C6E3B1}
Media Path: /sitecore/content/Home/Developers/Devices/ContextDevice
Parent Path: /sitecore/content/Home/Developers/Devices
Path: /sitecore/content/Home/Developers/Devices/ContextDevice
Hide Version? False
Never Publish? False
Publish Date: 1/1/0001
Unpublish Date: 12/31/9999
Valid From: 1/1/0001
Valid To: 12/31/9999
Browse Only: False
Is Modified? False
Invalid? False
Is External? False
Is Virtual? False
Owner DB Name: web
Read Only Stats: False
Sort Order: 
Temporary: False
Runtime Valid From: 1/1/0001
Runtime Valid To: 12/31/9999
Template Name: TIC-PermBuilderPage
URI: sitecore://web/{F01CA6B2-E36D-4AF0-84F2-E533F0C6E3B1}?lang=en&ver=1
Version Number: 1
Layout Name: TICBrowserLayout