I'm using SDL Web 8.5 While rendering a Component Presentation from child Publication, I need to validate the presence of the Component in it's top Parent Publication. It might happen that it's been created in level 2 parent Publication and localized in child or locally created in child Publication.
I do not receive a NULL object while creating a Component object with parent publication which does not exist but receive exception while accessing it's properties at runtime.
var ParentObject = this.Engine.GetObject<Component>(new TcmUri(repositoryChildObject.Id.ItemId,
repositoryChildObject.Id.ItemType, this.ParentPublication.Id.ItemId));
The globalObject is not NULL although such a Component does not exist in parent Publication.
globalObject.Title
throws an error
Component does not exist