I am wondering if there is a way to find out all content that a content is referencing (not being referenced by which can be found by using GetReferencesToContent).
- You can use IContentSoftLinkRepository.Load(ContentReference contentLink, bool reversed) to find the SoftLink (basically links that are in contentarea for example, IIRC), and then iterate over the Property to check if there is any ContentReference property and where it is pointing to.
Dynamically looping through all the properties although you'd have to look in to content areas and any blocks if you wanted to go beyond the page. I think there's been blog or fourm with example core for this
There is nothing out-of-the-box.
Combining what Quan and Scott are saying you'd have to do something like this:
public ICollection<ContentReference> GetReferencesFromContent(ContentReference contentLink)
// Service locator used purely for example purposes :)
var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
var contentSoftLinkRepository = ServiceLocator.Current.GetInstance<IContentSoftLinkRepository>();
var content = contentLoader.Get<IContent>(contentLink);
var contentLinks = new List<ContentReference>();
foreach (var property in content.Property)
// Get straight content references
if (property.PropertyValueType == typeof(ContentReference))
var link = property.Value as ContentReference;
// Get IList<ContentReference> links
var links = property.Value as IEnumerable<ContentReference>;
if (links != null)
// Get links from ContentAreas, LinkItemCollection and XhtmlStrings
var softLinks = contentSoftLinkRepository.Load(contentLink).Where(x =>
x.SoftLinkType == ReferenceType.PageLinkReference || x.SoftLinkType == ReferenceType.ImageReference);
contentLinks.AddRange(softLinks.Select(x => x.ReferencedContentLink));
Definitely don't think this is comprehensive, but hopefully it gives you a starting point.
Thank you for your replies. I will try it out :)