I'm planning on implementing a system in MOSS 2007 that allows end users to rate and comment against each page on the site. I plan to create a comments list which has column to store the pages URL. I can foresee the situation however when a page has its URL changed or the page/site gets moved that it will lose a reference to all of its comments etc.

I could feasibly write an event receiver that watches for URL changes but I'm not sure I can capture site or page moves? Is there another identifier that would allow for 2 way referencing? i.e. A page can lookup all of its comments and a comment can find which page it was related to?

FYI - we have a fairly large site with 100's of subsites each with their own pages library. So any event receiver would need to be deployed across the board...



You could use the SPFile.UniqueID

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.uniqueid.aspx As everything in a Sharepoint list is probably an SPFile, you can get the UniqueID of, well, every file in the lists.

We use this guid to maintain a list of url's of the pages and it works quite well.


Well i would suggest you to have a column created in you content type eg. PageUniqueID (text type) from which you inherit your page from. This can be a simple text field. Further you can write some code that generated a unique GUID and puts it into PageUniqueID field as soon as you create a page. Now in your comments list you can have a SourcePageID (text type) field where for each comment you could track its source page via this GUID value rather then its URL. Thus even if you move your site or page, your PageUniqueID would always be same and would always stay connected with the comments list and vise versa.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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