1

This was something I am more curious about, than a solid programming issue to be solved. Sorry about that in advance.

I noticed that when inserting images into a publishing page's Page Content field, SharePoint is doing something to track changes to that image's file name. I am just curious if anyone know what or how it does it.

If you change the file name in the library, or move it to a different folder in that library, it automatically updates the html link reference on the page it was inserted.

Pretty cool but it gets weirder.

If you manually paste in your own image link HTML code directly into the Edit HTML dialog for an image in your Images library (any library really, this works for documents too), and then go change the name or location, it updates your HTML.

If you change your img tag to point to a file that does not yet even exist, and THEN upload and image with that name, not only will it appear on your page (as expected) but if you update the image name in library, it updates your HTML correctly then too.

By this point the voodoo was too strong for me to fathom how this was possible, since it happens when the file is updated (seemingly), not when the HTML is updated, since you can put the link in first, and then update image name later.

Does anyone know, or have any decent guesses who this is done?

1 Answer 1

2

I think the forwardlinks property of an SPFile is what saves all of the info on where to update when this file changes: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.forwardlinks.aspx

As far as how this property get's populated, I am unsure.

1
  • Excellent! I think that is exactly what I wanted to know. The mechanism is less important to me than the existence of that property. Commented May 1, 2012 at 15:57

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.