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