PageData GetRelatedItems giving item not found error
I've having a problem when calling GetRelatedItems<Image>("fieldname") on a PageData variable. For the page in question, I'm sure that the related item is there, but it was never found. This related item is a custom field for all pages.
So I turned it around and retrieved the image id from the ContentLinksManager:
ContentLinksManager contentLinksManager = ContentLinksManager.GetManager();LibrariesManager librariesManager = LibrariesManager.GetManager();var imageId = contentLinksManager.GetContentLinks( ) .Where( l => l.ParentItemId == parent.NavigationNodeId ) .Select( x => x.Id) .FirstOrDefault();'parent' it the above snippet is a PageData variable. This returns the Guid of the image. Then I call:
Image imageItem = librariesManager.GetImage( imageId );I'm getting a Telerik.Sitefinity.SitefinityExceptions.ItemNotFoundException at this point.
The strange part is that if I get the same page, but use the PageNode type, the related item is retrieved normally. As in here, where 'page' is a PageNode variable:
var imageItem = page.GetRelatedItems<Image>( "LandingPageMenu") .FirstOrDefault();