Finding all pages that contain a reference to a given page in a contentarea

Vote:
 

I have a page that has a contentarea that allows references to other pages.   Specifically, I have a ClinicPage which has a ContentArea to hold ProviderPages, for each provider in the clinic.  Providers can be in multiple clinics.

I'd rather not have to maintain this relationship in both directions by having a ContentArea on ProviderPage to hold the clinics, but I'd like the provider page to link to each clinic the provider is a member of.

How do I query EPiServer to find every clinic page whose contentarea holds a reference to the provider page?

#80957
Feb 05, 2014 21:42
Vote:
 

If I understand your request correctly, you could check my blog for inspiration.

#80959
Feb 05, 2014 23:55
Vote:
 

Note that The IContentRepository.GetReferenceInformationForContent method Alf referres to will not only capture references from ContentAreas, it will also capture references from e.g. XhtmlStrings, Url, ContentReference, ArchiveLink, ShortcutLink properties.

You could use EPiServer.DataAbstraction.ContentSoftLinkRepository.Load instead, that will limit the checks to custom properties (metadata properties are excluded). It will however also check custom XhtmlStrings, Url, ContentReference properties.

#80961
Feb 06, 2014 8:50
Vote:
 

Cool Johan, thanks for the update. I'd better check on that and update the post.

What do you mean when you say metadata properties?

#80962
Feb 06, 2014 8:52
Vote:
 

With metadata properties I mean all properties that you have not explicitly added to your model classes. That is properties inherited from baseclasses or interfaces (like, ContentLink, ParentLink, ContentTypeID, Language etc)

#80963
Feb 06, 2014 8:54
Vote:
 

EPiServer.DataAbstraction.ContentSoftLinkRepository.Load has an overloaded method that takes a boolean parameter reversed. This can be used so you can either get "all content items that a specific content item references" or the other way around "all content items that references this specific content item"

#80965
Feb 06, 2014 8:58
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.