3

In the GUI it is possible to get the resources used by a page as shown by the image. Now I would like to get this information in the code behind so that I can modify only pages that are using a specific image. Where is this data stored?

Image showing related resources

1
  • are you using Server Side Code ? Commented Feb 2, 2015 at 10:40

1 Answer 1

2

Disclaimer: I don't know how that specific functionality is implemented, so it is possible that there exist a simpler way to achieve the same results as my proposed solution.

Looking at SharePoint object model, the only way that comes to mind to achieve that is to work backwards - checking for each file if it has a relation to the original listitem.
The SPFile object exposes the BackwardLinks property which represents the list of files that "utilize" the current checked one.

This means that for example it is possible to use this property to check if a page layout is in use: the BackwardLinks property would include all pages that use the inspected layout.

I can only assume that the "related files" functionality works by accessing that property. Basically, when you use it on a file it scans the site collection for other files whose BackwardLinks collection contains a reference to the original one.

Anyway - to achieve your goal, modify only pages that are using a specific image it should be sufficient to check the BackwardLinks property on the SPFile instance representing the target image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.