Sample how to use EPiServers CMD LinkCollection property in a more advanced way.
Extract page references
This example extract page references from a LinkCollection.
public static EPiServer.Core.PageReferenceCollection GetLinks(LinkItemCollection value)
{
EPiServer.Core.PageReferenceCollection ret = new PageReferenceCollection();
foreach (LinkItem link in value)
{
Guid id = EPiServer.Web.PermanentLinkUtility.GetGuid(link.Href);
PageReference pageLink =
EPiServer.Web.PermanentLinkUtility.FindPageReference(id);
if (PageReference.IsNullOrEmpty(pageLink))
{
//This sample only extract page references
continue;
}
ret.Add(pageLink);
}
return ret;
}